Dear,
I am using your grid and want to start implementing the simple filter option.
However, one important thing my end user expect is that what they type in this filter row is stored so they can load the page use the stored filter values.
So my question drills down to how can I get the values from the filter row , and how can I set these values and manually start the filter event in the grid.
If you have any other questions or need further assistance, please do not hesitate to contact us. I will be glad to help.
This is right, this should work. I recommend triggering the filtering after the grid is initialized like this:
<script>
$(function () {
$("#grid").igGrid({
// grid settings
});
$("#grid").igGridFiltering("filter", filt);
</script>
Please do not hesitate to contact us if you find troubles setting the manual filtering, I will be glad to help.
Thanks for the response,
What I am trying to realize is.
We have a page with a grid on it, let say www.test.be/products , the grid in question will have 3 columns ( name, brand, number) and a filter row.
When the user fills in a value in the filter row we want to filter of course, but at the same time we want to change the url to
" www.test.be/products#filter:q1YqKMpMTvVNrFCyMrYw0IFyM_OUrAxqAQ" , this url parameter must contain the filter values ,
When the same user or even another user navigates to " www.test.be/products#filter:q1YqKMpMTvVNrFCyMrYw0IFyM_OUrAxqAQ" the grid will be loaded, WITH the filter values filled in and the grid must preform the correct filter.
With what you proposed , I would go about this like so.
In jquery catch the dataFiltering event and using filt = ui.expressions get the filter value and serialize this to the URL.
Upon navigating to the page I would desiarilize the URL and get the filter values, and then set the filtering manually using
Would this work?
With regards,
Dimitri
Hello Dimitri,
Thank you for posting in Infragistics forum !
Ignite UI igGrid and igHierarchical Grid now provide the persistence feature, which maintain the states between re-bindings. This options is set to true by default. The filtering feature is supported by the persistence and that means whenever you make data bind it will not destroy your filtered data. You can find more information about the persistence feature at http://ko.infragistics.com/community/blogs/marina_stoyanova/archive/2014/06/02/feature-persistence-in-the-jquery-iggrid-and-ighierarchicalgrid.aspx
However if you want to use the filtering values after page reload, not only after data binding, maybe you will need a custom solution that the API cannot provide. Please clarify what exactly you want to achieve so as to provide you guidance on this. Do you want to reload the page with filtering applied, or you want the user to be able to use the stored values at any time after page reload ?
Regarding your next question - if you want to save the expressions from the filter row and manually trigger filtering, here is how you can achieve this:
1) Handle the dataFiltering event of the igGridFiltering
Use ui.expressions to get an array that contains the applied filtering condition, expression, and fieldMame the filtering is applied to. Example code:
features: [{
name: "Filtering",
dataFiltering: function (evt, ui) {
filt = ui.expressions;
},
...
2) You can use the filter method to manually filter the grid at any time you want. The method takes as an argument an expressions array, where you can pass the array obtained in the dataFiltering event:
Example code:
For the full API reference of the igGrid and igGridFiltering please go to http://help.infragistics.com/jQuery/2014.1/ui.iggridfiltering and http://help.infragistics.com/jQuery/2014.1/ui.iggrid
I hope this helps. If you come to trouble using the suggested options, please do not hesitate to contact us. Also please clarify the exact functionality you want to ahieve for the user. I will be glad to help you further with this.