Wijmo Gridview : Restoring Group States at Client Side
In my previous blog, I discussed how you can save the open group states when you have enabled server-side editing, as group states are lost when postback occurs. But, sometimes, you may have a situation where you need to refresh or redraw the grid at client side. At that time, you would face the same issue i.e. state of the opened groups are not retained. This blog implementation takes care of this behavior when Wijmo Gridview is re-rendered through its client side method “doRefresh”. To begin with, bind Wijmo Gridview to a DataTable say 'Products' and enable the scrollbars as shown below.
Now if we handle the resize event of the browser or any other event and use “doRefresh” method in order to redraw the grid, then all the groups will revert to their original state i.e. collapsed. Even, if the end user has opened ‘n’ number of groups. To maintain the opened states of the groups, you need to save the indexes of the groups which are open in the same event but before “doRefresh” is called. Using the saved list of indexes, you can restore these groups with the help of OnClientRendered event. See the complete code below.