jQuery UI Widgets › Forums › Grid › Three bugs related to Grid's "loadstate" function:
This topic contains 3 replies, has 3 voices, and was last updated by anamika12 9 years ago.
-
Author
-
Hello !
Thank you for the wonderful feature of allowing the grid state to be saved/loaded ! And looking forward to improvements to it, for example customizing what kind of data is restored (for example, ability to restore only filters without changing column order, page size, etc.), and also the ability to initialize a grid with an initial custom state ( and not just load it after the grid has been created )
Right now I’m reporting a few problems I discovered while working with the “loadstate” function on a grid which uses dataAdapter to load data remotely.
The code is too complex to post here completely, but I’ll highlight the important and relevant settings:{
source: new $.jqx.dataAdapter( … ), // settings to access remote data using JSON protocol
virtualmode: true, // using virtual paging and filtering
rendergridrows: function(params) { return params.data; },
filterable: true, showfilterrow: true,
autosavestate: true
// … and other settings related to columns/looks/design
}Using latest version 2.8.3 and jQuery 1.8.3
1. Numero uno:
If the new state which is about to be loaded has groups and the grid doesn’t, it will mess up the columns and the grouping row (doesn’t show up but the grid thinks it has groups ). An even more pronounced problem is when the grid HAS currently groups and the new state doesn’t. Switching from one groups set to another works, just activating/deactivating groups with “Loadstate” is problematic.
For this one I found a workaround, by manually setting groups before applying loadstate:
var current_state = $(“#issues-grid”).jqxGrid(‘getstate’);
if(new_state.groups.length > 0 && current_state.groups.length == 0) { // no to yes
for(var c = 0; c 0) { // yes to no
$(“#issues-grid”).jqxGrid(‘cleargroups’);
}Still, it is a bit frustrating, hope this is fixed.
—-
2. Numero due:
When applying a new state which has filters on a grid which doesn’t currently have any filters, this happens ( show in the console: )
Error: jqxGrid: The data is still loading. When the data binding is completed, the Grid raises the ‘bindingcomplete’ event. Call this function in the ‘bindingcomplete’ event handler.
[Break On This Error]jqxgrid.filter.js (line 7)
Obviously, I cannot put something on “bindingcomplete”, since the process is internal to jqxgrid.storage.js and jqxgrid.filter.js …
Didn’t found a workaround for this one so far, the filters do not apply when loading the new state.
—-
3. Last one:
If the new state has both “groups” and “filters”, it sends the AJAX request TWICE one after another with exactly the same parameters (filters)
GET http://localhost/listing?action=g … afield4=_status&mawboperator=and&_=1368957037294
GET http://localhost/listing?action=g … afield4=_status&mawboperator=and&_=1368957037335These two requests are one after another in the console and they basically make the grid render twice quickly with the same data.
p.s. – Please know that I’ve been working with jqWidgets for over 7 months already, especially with the grid widget, I know it well and already tried everything possible to avoid/make workarounds for these problems… while the first one has been fixed, the other two I can’t change. (I don’t have the source code of jqWidgets right now, 399$ for a developer license is a lot of money for me for the moment, at least until I manage to finish the project and get my money)
The forum post ate some lines:
if(state.groups.length == 0 && current_state.groups.length > 0) { // yes to no
$(“#issues-grid”).jqxGrid(‘cleargroups’);
}
if(state.groups.length > 0 && current_state.groups.length == 0) { // no to yes, manually create groups
for(c = 0; c< state.groups.length; c++)
$(“#issues-grid”).jqxGrid(‘addgroup’, state.groups[c]);
}This is the workaround for the bug #1
—
I just noticed that not only the filters, sometimes even the columns or column orders are not restored correctly. It appears that state loading function is attempting to do several things (set columns, set filters, set page/groups) all at once and fails some of them at random.I only noticed the problem when loading very different states ( for example, that have other filters, a different column order and other groupings of data ). If only the column order is changed, it loads correctly. Similar, if only a few filter parameters change, they do load correctly.
Hi,
We will investigate the reported issues and if we reproduce them we will add the appropriate work items.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHello sir,
Is this problem fixed now?
Thanks
-
AuthorPosts
You must be logged in to reply to this topic.