I’m want to create a jqGrid with grouping:true, but only first group expanded and another groups stay collapsed when expand this group, was been collapsed, I need to load the data from the server.
Someone has a solution for that?
PS: I need use grouping, why the user can be select another columns to group on the fly.
To implement your requirements you should use
groupCollapse: trueto have all groups displayed in collapsed form. For example likeand then expand the first group with respect of groupingToggle after the grid are filled. For example you can use the following code inside of
loadComplete:If you remind the fact how the ids of the grouping rows of the grid will be constructed you can reduce the code to the following
See the demo.
To change on the fly the column used for grouping you can use
groupingGroupBymethod:For example
$("#list").jqGrid('groupingGroupBy', 'ship_via');. You should understand that the newgroupFieldwill be used only after the next filling of the grid body. So if you want to define on the server the grouping order and include it in the server response you should callgroupingGroupBymethod inside ofbeforeProcessingand not inside ofloadComplete.