jQWidgets Forums
jQuery UI Widgets › Forums › Grid › updatebounddata and grouping
Tagged: datagrid, grid grouping
This topic contains 5 replies, has 2 voices, and was last updated by Benny 4 months, 2 weeks ago.
-
Author
-
Hi,
I’ve been working on switching “view” on an active grid. After much testing I’ve found out that updatebounddata sometimes removes grouping:
$(‘#jqxgrid’).jqxGrid(‘groups’, [‘firstname’]);
$(‘#jqxgrid’).jqxGrid(‘updatebounddata’); // No extra parameter: sorting is removed.When supplying an extra parameter, the grouping is not removed:
$(‘#jqxgrid’).jqxGrid(‘groups’, [‘firstname’]);
$(‘#jqxgrid’).jqxGrid(‘updatebounddata’, ‘filter’); // works with ‘sort’, ‘data’ and ‘cells’ as well.Should grouping always be done after updatebounddata, or is there something I’m missing?
Correction last post is about grouping: // No extra parameter: grouping is removed.
After some more testing, It seems that the same does apply for sorting:
$(‘#jqxgrid’).jqxGrid(‘sortby’, ‘firstname’, ‘desc’);
$(‘#jqxgrid’).jqxGrid(‘updatebounddata’); // sorting is removed$(‘#jqxgrid’).jqxGrid(‘sortby’, ‘firstname’, ‘desc’);
$(‘#jqxgrid’).jqxGrid(‘updatebounddata’, ‘sort’); //sorting remains, but only when passing ‘sort’ or ‘cells’Hi Benny,
This is the idea of these parameters of updatebounddata, to keep the sorting, filtering, etc. Otherwise, updatebounddata re-bind and re-renders completely the Grid component.
Regards,
PeterjQWidgets Team
https://www.jqwidgets.com/I expected updatebounddata() to keep the configured sorting and grouping and completely re-bind and re-render everything, since in the documentation is says: “To make a full update, do not pass any parameter.”
However after doing some performance testing, the grid API seems to be more designed to respond to user inputs, applying one change at a time. When making many changes in one go, it is very inefficient and I need to deal with all these strange cases. It is much faster to create a new grid, which also simplifies my code a lot. Creating a new grid is very fast.
Hi Benny,
For multiple updates at once, the Grid also has beginupdate and endupdate methods. The first one stops the rendering, the second one resumes it.
Regards,
PeterjQWidgets Team
https://www.jqwidgets.com/beginupdate does not work for me. When calling setoptions or groups, I get the error: Cannot read properties of null (reading ‘visiblerecords’).
$(‘#jqxgrid’).jqxGrid(‘beginupdate’);
$(‘#jqxgrid’).jqxGrid(‘groups’, [‘firstname’])
$(‘#jqxgrid’).jqxGrid(‘endupdate’); -
AuthorPosts
You must be logged in to reply to this topic.