I have a problem, where I’m trying to apply a multi value filter to a column.
I have set the Column in colDefs to have filter: 'agSetColumnFilter',
With that in place, in my process I build an array of values, that I’m trying to filter on. I use this array in setModel
, however it is not working. By not working, my grid basically get’s cleared and there is nothing showing.
However, if I try to use the same approach, but instead only try to filter on a single value, something like arr[0], then the grid properly works and does the filtering as expected. So the filter functionality works, it just won’t let me do it on multi value.
In my code, I create an array of values that I want to apply to a specific column, so let’s say I have a Col1 that I’m trying to filter:
var valsToFilter=[];
valsToFilter.push('hey');
valsToFilter.push('bye');
var filterColumn = 'Col1';
var fil = grid.api.getFilterInstance(filterColumn);
fil.setModel({values:[]}];
fil.setModel({
values: valsToFilter
}); //This does not work
fil.setModel({
values : valsToFilter[0]
});//but this works
fil.applyModel();
grid.api.onFilterChanged();