I know how to specify to hide a column in the grid using the property columnDef:
JSON is
{hide: true}
I would like to set a text filter in the column def as a default when showing the grid but allow the user to change the filter using the grid column filter tools.
For example I have a field/column called ‘source’ that might contain ‘Deleted Account’. I would like to “pre-filter” by having the equivalent of a function like:
source.notContains( 'Deleted' )
Is there a place or doc where I can find out the syntax for this?
After some reading of docs I did find this api:
setFilterModel(filterModel)
And using this code:
var filterModel_status = {
"id_status": {
"filterType":"text",
"type":"notContains",
"filter":"Deleted"
}
};
elements.datagrid_student.setFilterModel(filterModel_status);
The filter is set when I view the grid.
However the docs have only an example of
`"type" : "contains"
I guessed at “notContains” and it worked.
However where do I find the other permissible values?
OK - more researching and found them in here Text Filter Options
More Issues:
can we only execute one of these ‘setFilterModel’ ?
I tried doing one call for each column and none work.
I tried placing both columns in the same object:
var filterModel_both = {
“id_status”: {
“filterType”:“text”,
“type”:“notContains”,
“filter”:“Deleted”
},
“id_role”: {
“filterType”:“text”,
“type”:“Contains”,
“filter”:“User”
}
};
And then called setFilterModel but only the first column (id_status here) was applied. The column filter for id_role was ignored.
Is this a limitation?