I am trying to enable/disable grouping dynamically on a jqGrid on a button click, but it does not seem to be working. I am trying with this code but no luck
$('#mybutton').click(function(){
$('#mygrid').jqGrid('setGridParam', { grouping:true });
});
The grouping is generated with the following
groupingView : {
groupField : ['product'],
groupColumnShow : [true],
groupText : ['<b>{0}</b>']
}
Thanks!
Grouping feature has some method which you could use: groupingRemove, groupingGroupBy, groupingToggle.
To remove the grouping you can use
grid.jqGrid('groupingRemove', true);
(where var grid = $('#list');). To enable grouping you can use the code like
grid.jqGrid('groupingGroupBy',['product']);
or for example
grid.jqGrid(
'groupingGroupBy',
['product'],
{ groupText: ['<b>Product(s): "{0}" - {1} item(s)</b>'] }
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With