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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:28:10+00:00 2026-05-30T04:28:10+00:00

Concerning the jquery datatables rowgrouping plugin: http://jquery-datatables-row-grouping.googlecode.com/svn/trunk/index.html , is it possible to have the

  • 0

Concerning the jquery datatables rowgrouping plugin: http://jquery-datatables-row-grouping.googlecode.com/svn/trunk/index.html , is it possible to have the two-level grouping and also have both groupings expandable / collapsible? I couldn’t find anything on the site mentioning this.. wondering if any has tried it

  • 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-30T04:28:12+00:00Added an answer on May 30, 2026 at 4:28 am

    I didn’t see anything either about the plugin doing this. I think the most efficient solution (in terms of runtime) would be to modify the rowGrouping plugin itself, but that might get complicated every time the creator updates the plugin (and to the best of my knowledge, it’s not really possible to extend a jQuery plugin).

    Anyway, I came up with a solution. It’s not pretty and could stand to use a lot of improvement, but hopefully it serves to spark some ideas at the very least. Basically I created my own jQuery plugin that wraps the rowGrouping plugin (you could also just use the middle part by itself – see notes in code). It instantiates a rowGrouping dataTable then traverses the rows looking for subgroup rows within each major group. Then it finds rows under each subgroup and assigns them a class unique to that group/subgroup combination. Finally, it uses this class as a selector to toggle the rows when a subgroup row is clicked.

    // create our own jQuery plugin that wraps rowGrouping
    (function ($) {
        $.fn.rowGroupingWithColapsableSecondLevel = function (options) {
            return this.each(function (index, elem) {
                // construct a rowGrouping object
                var oTableGrouped = $(elem).dataTable().rowGrouping(options);
    
                // subgroup row/tds are not uniquely identified
                // find each group row (identified by it's td having the class .group) and identify it (via a unique class per subgroup) and bind a click to the subgroup row that will toggle this class
    
                // SIDE NOTE: if you don't want to use the plugin wrapping method, just isolate the following "find" block and replace oTableGroup with a reference to the table object (or create an object or function with the find block)
                // example: var myTable = $('#example').dataTable().rowGrouping(); // then use myTable.find... below
    
                oTableGrouped.find('tbody tr td.group').each(function(index, elem) {
                    var groupName = $(elem).attr('rel'); // e.g., group-1
                    var tr = $(elem).parent();
                    var subgroupId = 0; // incremental Id within group
    
                    // go through subsequent rows looking for subgroups until we hit another major group (or run out of rows)
                    do {
                        var tr = tr.next('tr'); // get the next row
                        if (tr.find('td').hasClass('subgroup')) {
                            // this is a subgroup row
                            subgroupId ++;
                            // give this subgroup an id so we can work with it
                            tr.attr('id', groupName + '-subgroup-' + subgroupId);
                            // assign parent group id as class so it will be toggled with other rows
                            tr.addClass('group-item-' + groupName);
                            // assign a toggle function
                            tr.click( function() {
                                $('.' + $(this).attr('id')).toggle();
                            });
                        } else if(tr.find('td').hasClass('group')) {
                            // we've reached the next group, exit the do loop (the next group will be picked up by the next oTableGroup.find)
                            break;
                        } else if(tr.length == 1) {
                            // this is a row under the subgroup, identify it by adding a class
                            tr.addClass(groupName + '-subgroup-' + subgroupId);
                        }
                    } while (tr.length == 1);
                }); // end of the find block
    
                return oTableGrouped;
            })
        };
    })(jQuery);
    

    And here’s how you would use it:

    $(function() {
        var oTable = $('#example').dataTable({ "bLengthChange": false, "bPaginate": false}).rowGroupingWithColapsableSecondLevel({  "iGroupingColumnIndex2": 1 , "bExpandableGrouping": true });
    });
    

    Hope this helps. Cheers.

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

Sidebar

Related Questions

I have the following JQuery Code concerning my tabs : $(#onglet>ul>li).click(function(){ $(#onglet ul li).removeClass('Selectionne').addClass(OngletPrincipal);
I have a small question concerning css styles and javascript / jquery. Lets say
I am using jQuery and I am loading dynamic HTML via PHP. My question
I have a problem concerning Ajax and Jquery. I have a bunch of <li>
I have a question concerning functions with jQuery. I have a function that once
My website, http://kenthomes.com.au/test/gallery.php , works fine in normal browsers like FF, Chrome, Safari and
I've been using Jquery for some time now and I have a question concerning
I received some amazing help from others, concerning finding and replacing text with jquery.
I have a teeny tiny little issue concerning a jQuery-based slideshow in Opera. What
I am trying to modify this JQuery Countdown plugin to initialize itself when it

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.