Grouping Toggle / Untoggle All

QuestionsGrouping Toggle / Untoggle All
Matthew asked 4 years ago

Hi Abu,

I've got a grid with 2 nested layers of grouped items which is working fine:

$grid["groupingView"]["groupField"] = array("name","coupon");

What I would like to do is have a "+" button either in the header or in the buttons at the bottom of the table that will collapse or expand all the grouped rows. I've searched in the forum and found the code for a similar thing for SubGrids however can't make it work for Groups.

I can see the code that runs when clicked the +/- is:
onclick="jQuery('#list1').jqGrid('groupingToggle','list1ghead_1_516');return false;

I want to get all the 'list1ghead_#####' items and loop through them to collapse/expand. Ideally as well since it is nested is there a way to have a collapse/expand all option inside the nesting, i.e when I click the first "+" to show the sub grouped items there is an option inside there to only expand all those under the first layer of the nest?

Thanks mate,


2 Answers
Abu Ghufran answered 4 years ago


You can review online demo

and code:

It allow toggle all to collapse/expand state.

Matt answered 4 years ago

Thanks Abu, I was able to get it to work ok with a minor modification to the demo code. Here's the addition for anyone else wanting to do something similar:



Your Answer

4 + 10 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?