jQuery UI Widgets › Forums › Grid › loading jqgrid with predefined filter
Tagged: filter, grid control, ready, state
This topic contains 12 replies, has 3 voices, and was last updated by Peter Stoev 7 years, 11 months ago.
-
Author
-
I need load jqxgrid with predefined filter.
I know about autosavestate/autoloadstate but this features refresh grid after initialization. events are as follows:
1. sending UNFILTERED data to server
2. bindingcomplete (getstate gives empty filter)
3. initialized (getstate gives empty filter)
4. ready (getstate gives empty filter)
5. sending FILTERED data to server
6. bindingcomplete (getstate gives filled filter)
….can i somehow (in elegant way) force grid to send first request with filtered data.
more precisely I need do some action in “ready” event based on saved filter (highlight some row). BUT i can’t perform my action on step 3 because filter is undefined on step 3. Perform my actions in step 6 is also bad idea because
“bindingcomplete” event is not unique.Thanks
Hi,
The only way to load a Grid with applied filter is demonstrated here: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/filtering.htm?web.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/thanks, so answer for my question is “no”, provided example also force grid to load data twice.
thanks
Hi,
Actually, in the sample the data is loaded once and then a filter is applied on the loaded data. For server filtering, the scenario is different because when a filter is applied, a new server call is made to get the filtered data set that will be displayed in the Grid.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comyes, thanks again
In my opinion (humble!!!) event “ready” should be fired after second request is performed.
because after first request grid is not ready yet.I want highlight some row when page is loaded. Best to do it in “ready” event. but if grid is reloaded after 1st ready – it’s have no sense.
in “bindingcomplete” i also can’t do it because i need highlight only at web page load (once).Of course there are dirty ways
1. define “realready” function and call it only once in second “bindingcomplete” (if grid state are stored in storage) or in first “bindingcomplete” (if grid state are not stored in so, grid will not be reloaded)
2. play with data sourceI used first way but it look disgusting for me.
Nut maybe already exists “realready” event and i just overlooked it?Thanks
Hi ntaxa,
The “ready” callback is raised when the Grid has loaded the data and displayed it. It is correctly called and does what is expected from it. However, we should add a way to add a predefined filter before the Grid’s loading and we will do it in a future version.
Best Regards,
Peter StoevjQWidgets Team
https://www.jqwidgets.comthanks!
one more question (“ready” relevant). there is some event raised when grid is already rendered (i mean when DOM is changed).
if i am right – bindingcomplete, initialized, and ready – all this functions are called _BEFORE_ DOM is rendered. or i am wrong?thanks again.
See comment on April 21, 2013 from Peter Stoev. Has this been added to the functionality of the JQWidgets? If not, how can I work around this issue and not have the second call to the server? I need a default filter and I don’t want two calls to the server. If this can be done, can you add an example? I am not finding one, and I have been searching. I am on release 4.1.2.
Initial filter is available in case the data is loaded at once: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/initialfilter.htm?light. For virtual mode scenarios, server call cannot be avoided.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Thank you so much for your response and example. This works great except that it adds 2 “Select All” options in my checkedlist filter. I have a filteritems – a list that I created that is a key value pair. I have filtertype – “checkedlist”, and I have filter – the function like in your example. So how do I remove the double “Select All”?
Could you share a jsfiddle.net example with our Grid which demonstrates that behavior?
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/I think it has to do with the showfilterrow being used.
http://jsfiddle.net/bmcgahee/ofxvLhkk/2/This was my first time on jsfiddle, so let me know if you have problems with it. The dropdown list shows 2 of the Select All.
There are 2 issues here. One is in the Grid, others in the fiddle. The issue in the Grid will be resolved in the next week’s release. It is the duplicated Select All item when a filter is applied. The issue in the code is that the filter is with “contains”, not “equal” as expected for boolean values like in the checkedlistbox.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.