I want to apply filters on multiple iggrid columns based on URL parameters. Following code just show the last filter only. It ignores or overwrite what previous filter condition set.
//value is multiple columns filter details separated by ;
var columns = value.split(";")
for (i = 0; i < columns.length; i++) {
state_grid.igGridFiltering("filter", [{ fieldName: columns[i][0], expr: columns[i][2], cond: columns[i][1] }]);
}
I was going thru this iggrid forum and found multiple filters can be applied like:
$("#grid1").igGridFiltering("filter", [
{fieldName: "MakeFlag", expr: true, cond: "true" , logic: "AND"},
{fieldName: "ProductID", expr: 3, cond: "equals", logic: "OR"}
]);
If I hardcode the filter conditions, it works fine and filter text is shown on all columns. My question is how do I dynamically generate this in jQuery and pass it to igGridFiltering event. These conditions has to be loaded based on URL query strings. Can it be done like:
var expression='';
for (i = 0; i < columns.length; i++) {
var vl = columns[i].split('_');
expression += '{ fieldName:'+ vl[0]+', expr:'+ vl[2]+', cond:'+ vl[1]+' },';
}
state_grid.igGridFiltering("filter", [expression]);
Please help on this.