Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6893791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:42:10+00:00 2026-05-27T06:42:10+00:00

How can we have global Expand/Collapse for JQGrid when we have rows grouped on

  • 0

How can we have global Expand/Collapse for JQGrid when we have rows grouped on some field?

On expanding, it should expand all groups and on collapsing all groups should be collapsed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:42:10+00:00Added an answer on May 27, 2026 at 6:42 am

    You can set default value of the groupCollapse property of the groupingView parameter of jqGrid in the same way like you set any other default parameter:

    $.extend($.jgrid.defaults, {
        groupingView: {
            groupCollapse: true
        }
    });
    

    UPDATED: After additional explanation in the comments I can me imagine that in some cases it can has the behavior when all groups will be expanded/collapsed if any from the groups will be expanded/collapsed.

    var $grid = $("#list"), inOnClickGroup = false;
    
    $grid.jqGrid({
        // ... other options
        grouping: true,
        onClickGroup: function (hid) {
            var idPrefix = this.id + "ghead_", id, i, l,
                groups = this.p.groupingView.sortnames[0];
    
            if (!inOnClickGroup && hid.length > idPrefix.length &&
                    hid.substr(0, idPrefix.length) === idPrefix) {
                id = Number(hid.substr(idPrefix.length));
                if (typeof (groups[id]) !== "undefined") {
                    inOnClickGroup = true; // set to skip recursion
                    for (i = 0, l = groups.length; i < l; i++) {
                        if (i !== id) {
                            $(this).jqGrid('groupingToggle', this.id + 'ghead_' + i);
                        }
                    }
                    inOnClickGroup = false;
                }
            }
        }
    });
    

    See the demo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a javascript function (function1) that checks some global variables (can the user
In Actionscript you can have global variables like this: var number : Number =
Can Dynamic libraries have global, local and static variables in linux? If yes, then
You can have different naming convention for class members, static objects, global objects, and
I am trying to do have a global string in Installshield so I can
In C++ one can have a 'GLOBAL FUNCTION', which means it does not belong
can we have a single global variable which can be manipulated by multiple forms
I have a global object MyFruits that can have multiple properties. At a minimum,
can I have a global dict in my code which is something like the
Does PHP have global variables that can be modified by one running script and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.