jQuery UI Widgets › Forums › Grid › Porgramatically setting Filter
Tagged: addFilter, angular grid, Applyfilter, applyfilters, filter, grid, jquery grid, jqxgrid
This topic contains 2 replies, has 2 voices, and was last updated by George S 10 years, 4 months ago.
-
Author
-
I have a button, which is supposed to create and enable a filter. When I run it, everythign appears to run, the column turns blue, but no data is filtered, and when I look at the filter drop down, it does NOT have the values in it (unlike your example I am at a loss as to why.
Here is my code.
var myGrid = $("#productListDetail"); // Clear any existing filters myGrid.jqxGrid('clearFilters'); // Create a NEW FILTER object var filtergroup = new $.jqx.filter(); var filtercondition = 'contains'; var filtervalue = 'DATABASE'; // create and add the filter. var filter1 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition); myGrid.jqxGrid('addfilter', 'PROD_TIER4_DESC_FPH', filtergroup); // apply the filters. myGrid.jqxGrid('applyfilters');Any help appreciated.
As a followup question, does this syntax/functionality work if Filtermode = Excel? I am NOT using that, but would like to at some point…
Hello George S,
Your code seems correct. Could you, please, share a complete jsEditor/JSFiddle example reproducing the reported behaviour, so that we can test it and determine what causes the issue? Please also share if any errors are thrown in your browser’s console.
In
filtermode: 'excel', filters can be applied programmatically the same way.Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Solved: I did not have the filtergroup.addfilter statement.
Bottom portion of code SHOULD be…
// create and add the filter. var filter1 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition); filtergroup.addfilter(filter_or_operator, filter1); myGrid.jqxGrid('addfilter', 'PROD_TIER4_DESC_FPH', filtergroup); // apply the filters. myGrid.jqxGrid('applyfilters');Thank you
-
AuthorPosts
You must be logged in to reply to this topic.