Title: Datagrid row filter - default filterRules not working first remote call - Revis Post by: phunksta on December 18, 2014, 10:03:00 AM Regarding this bug report thread (http://www.jeasyui.com/forum/index.php?topic=3469.0)
I am also seeing this behaviour. I have tried all sorts of combinations of invoking datagrid load, enableFilter and filterRules but I always get several remote calls instead of 1. In my case I have a datagrid, with scrollview and datagrid-filter extensions. The datagrid starts as an empty element in html I initialise the datagrid in javascript, including the filterRules option I want to be active on first fetch. The first fetch omits the filterRule - when this is complete (about 6 secs) the datagrid shows this data 2 more fetches then occur, with the filterRule - when these complete nothing seems to happen (they come back before the first fetch < 1 sec) Nothing I do seems to be able to affect this. I just fetched the latest datagrid-filter extension file but I still get the issue. Where am I going wrong? ??? Title: Re: Datagrid row filter - default filterRules not working first remote call - Revis Post by: jarry on December 18, 2014, 07:26:59 PM Here is the solution to solve this issue.
1. Set the 'url' property to null to prevent from loading remote data. 2. Call 'enableFilter' method to enable the filter functionality. 3. Call 'load' method with a URL parameter value to load the remote data. Code: $('#dg').datagrid({ Title: Re: Datagrid row filter - default filterRules not working first remote call - Revis Post by: phunksta on January 05, 2015, 04:10:46 AM Hi Jarry, any many thanks for this suggestion.
I have tried this and unfortunately I still seem to get strange behaviour. I get 3 loads, 1 with no filterRules, then 2 with the filterRules I initialised in the first step. To complicate matters, I don't have a 'url' based loader, but a custom 'loader' function. So I am doing: Code: $dg.datagrid({ When I declare the loader, then the 3 loads begin. Without this I get an unloaded datagrid with the filter row shown, so I think the first and second parts are OK i.e. I can initialize the datagrid without it trying to load and then enableFilters. Please ignore - in the above I'm redefining the whole dg instead of extending. My stupid fault. Title: Re: Datagrid row filter - default filterRules not working first remote call - Revis Post by: phunksta on January 05, 2015, 08:00:12 AM OK a slight hack on this seemed to do the trick. It feels hacky though.
Code: url: null, |