I have implemented a jqgrid in grouping method. By default I have kept the groups collapsed using groupCollapse:true
parameter of jqgrid. My grid works well but When I expand the group and sort a column, the whole grid is reloaded and the expanded state of the column is not retained. How can I retain the expanded state while sorting?
相关问题
- Setting 'option' on jqueryui DatePicker cl
- How to bind a dropdown list inside jqgrid row cell
- jQgrid filterToolbar fails with searchOnEnter
- jquery-ui progressbar not showing
- JQuery - ToggleClass/AddClass/RemoveClass
相关文章
- jQuery UI Sortable: Scroll entire page as well as
- Set the z-index value of a jQuery autocomplete inp
- jqGrid Row Object in onSelectRow
- jQuery UI Sortable animations
- jQuery accordion: prevent pane from opening/cancel
- jQuery UI datepicker - Trying to capture click eve
- Disabling ctrl-click on jquery ui selectable
- Slide content / page transition
Please write always which version of jqGrid, which you use (can use), and from which fork (free jqGrid, commercial Guriddo jqGrid JS or an old jqGrid in version <=4.7).
Your requirements could be easy realized in "free jqGrid", which I develop. It allows to use
groupCollapse
as callback function, which returns Boolean (see the issue). In combination withonClickGroup
callback orjqGridGroupingClickGroup
event one can easy persist the grouping state.UPDATED: I created the demo https://jsfiddle.net/92da8xhq/, which demonstrates how one can persist the collapsing state in the grouping grid. Below I describe shortly the code. The demo uses one level of grouping to make the code more simple for understanding.
I added custom
collapsedGroups: {}
parameter to jqGrid. We will use the parameter to hold the list of collapsed groups. I usedcollapsedGroups: { "test2": true }
in the demo to demonstrated that we can create the grid with some collapsed groups at the beginning. We don't use the value of the property ofcollapsedGroups
object. Just the existence of the propertytest2
for example means that the group with the valuetest2
has collapsed state.The demo uses
groupCollapse
property ofgroupingView
defined as the callback function. The function tests whether the group is in the list of collapsed groups (hascollapsedGroups
property with some value)We adjust additionally the properties of the custom
collapsedGroups
parameter after expanding/collapsing of the group. We use the followingonClickGroup
callback: