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 8840589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:29:51+00:00 2026-06-14T10:29:51+00:00

I was able to implement grouping feature from examples in the jqgrid demo page.

  • 0

I was able to implement grouping feature from examples in the jqgrid demo page. But I don’t want to enable grouping by default but on the change of a select list I would like to enable the grouping feature. I have tried several options but none of them were successful? Could some one please help me here, may be I am missing something. Here is my code…

$("#dynamicGrouping").change(function() { 
    var value = $(this).val(); 
    if(value) { 
        if(value == '') { 
            $('#grid').jqGrid('groupingRemove', true); 
        } else { 
            $('#grid').jqGrid('setGridParam', { grouping:true });
            $('#grid').jqGrid('groupingGroupBy', value);
            $('#grid').trigger('reloadGrid');
        } 
    }
});

My grid definition:

jQuery(function() {
    $('#grid').jqGrid({
            .....
            .....
        grouping: false,
        groupingView : { 
                groupField : ['field_name'], 
            groupColumnShow : [true], 
            groupText : ['<b>{0} - {1} Item(s)</b>'], 
            groupCollapse : false, 
            groupOrder: ['asc'], 
            groupDataSorted : true 
            },
        .......
        .......
    });
});
  • 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-06-14T10:29:53+00:00Added an answer on June 14, 2026 at 10:29 am

    I supposed that you made some error in the code. The code which you posted seem me correct, but you don’t need to set grouping:true and trigger reloadGrid additionally because groupingGroupBy do this you automatically.

    The demo demonstrates setting or removing of grouping dynamically.

    enter image description here

    So you can use

    $("#dynamicGrouping").change(function () {
        var groupingName = $(this).val();
        if (groupingName) {
            $('#grid').jqGrid('groupingGroupBy', groupingName);
        } else {
            $('#grid').jqGrid('groupingRemove');
        }
    });
    

    or a little more advanced version

    $("#dynamicGrouping").change(function () {
        var groupingName = $(this).val();
        if (groupingName) {
            $('#grid').jqGrid('groupingGroupBy', groupingName, {
                groupOrder : ['desc'],
                groupColumnShow: [false],
                groupCollapse: true
            });
        } else {
            $('#grid').jqGrid('groupingRemove');
        }
    });
    

    UPDATED: Everything works with JSON data too: see the demo.

    UPDATED 2: I looked in the code one more time and I found out that gridview will set to true at the initialization of grid: see the lines. If you don’t have gridview: true and use initially grouping: false then you will be not able to change just grouping: true. You have to set also other parameters from the grouping limitations correctly.

    So you have to hold the rules from limitations yourself:

    scroll: false,
    rownumbers: false,
    treeGrid: false,
    gridview: true,
    

    By the way I recommend always use gridview: true because of better performance.

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

Sidebar

Related Questions

I'm trying to implement the Candlestick Google Chart, but I want to be able
I'm not able to implement these things,In this page I want to do implement
I want implement forward geocoding in my app. But I am not able to
Has anybody been able to implement a remember me feature with CodeIgniter's FreakAuth Library?
I want to be able to implement a button in my app, that quits
I want to be able to implement an ItemsControl with dragable items. The reason
Basically, I want a class to be able to implement two different versions of
I was able to implement a thread-safe Dictionary in C# by deriving from IDictionary
Has anyone been able to implement the JQuery grid plugin, jqGrid? I'm trying to
I want to implement Scrum, but I can't decide on a Sprint length. Ken

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.