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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:51:59+00:00 2026-05-24T21:51:59+00:00

I’ve tried to make a widget that can sort a group of rows separately

  • 0

I’ve tried to make a widget that can sort a group of rows separately inside a table and at the same time make the row-group to stick with “grouped rows”. I can’t figure out how to approach this problem …

EDIT: I want to sort on the non colspan columns. every group should behave as a sub-table

Basic setup in jsfiddle, can anyone push me in the right direction ?

EDIT: new jsfiddle http://jsfiddle.net/L8bwW/28/

  • 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-24T21:51:59+00:00Added an answer on May 24, 2026 at 9:51 pm

    Here is a Working example that does not use tablesorter.

    The key is to use the tbody element to group your rows. Then sort all rows but the last, within each tbody.

    The table might look like this:

      <table class="sortable">
        <thead>
            <tr> <th></th> <th>A-head</th> <th>B-head</th> <th>C-head</th> </tr>
        </thead>
        <tfoot>
            <tr> <td></td> <td>A-foot</td> <td>B-foot</td> <td>C-foot</td></tr>
        </tfoot>
    
        <tbody class='sortable'>
            <tr> <td>DDD</td><td> r1c1</td> <td>r1c2</td> <td>r1c3</td> </tr>
            <tr> <td>AAA</td><td> r2c1</td> <td>r2c2</td> <td>r2c3</td> </tr>
            <tr> <td>CCC</td><td> r3c1</td> <td>r3c2</td> <td>r3c3</td> </tr>
            <tr> <td>BBB</td><td> r4c1</td> <td>r4c2</td> <td>r4c3</td> </tr>
            <tr> <td colspan="4">summary info for the first group of rows</td> </tr>
        </tbody>
    
        <tbody class='sortable'>
            <tr> <td>Zorro</td><td> r5c1</td> <td>r5c2</td> <td>r5c3</td> </tr>
            <tr> <td>Caleb</td><td> r6c1</td> <td>r6c2</td> <td>r6c3</td> </tr>
            <tr> <td>Momo</td><td> r7c1</td> <td>r7c2</td> <td>r7c3</td> </tr>
            <tr> <td>Wolfie</td><td> r8c1</td> <td>r8c2</td> <td>r8c3</td> </tr>
            <tr> <td colspan="4">summary info for rowgroup #2</td> </tr>
        </tbody>
         ...
    

    And a sort fn for it might look like this:

      function SortIt() {
          jQuery('table.sortable > tbody.sortable').each(function(index,tbody) {
            var $rowGroup = jQuery(tbody);
    
            // select all but the last row in the tbody
            var rows = $rowGroup.find('tr:not(last-child)').get();
    
            var sortDirection = $rowGroup.is('.sorted-asc') ? -1 : 1;
    
            // Set a custom property on each row - 'sortKey', the key to sort.
            // This example uses the text in the first column. It could use
            // any column, or any content in the row.
            jQuery.each(rows, function(index, row) {
                row.sortKey = jQuery(row).children('td').first().text();
            });
    
            // actually sort the rows
            rows.sort(function(a, b) {
                if (a.sortKey < b.sortKey) return -sortDirection;
                if (a.sortKey > b.sortKey) return sortDirection;
                return 0;
            });
    
            // retain the summary row - the last one
            var summaryRow = $rowGroup.find("tr:last-child");
    
            // remove all the rows from the tbody
            $rowGroup.find("tr").remove();
    
            // append the rows in sorted order
            jQuery.each(rows, function(index, row) {
                $rowGroup.append(row);
                row.sortKey = null;
            });
    
            // append the final row
            $rowGroup.append(summaryRow);
    
            if (sortDirection == 1) { $rowGroup.addClass('sorted-asc'); }
            else {$rowGroup.removeClass('sorted-asc'); }
    
          });
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
Does anyone know how can I replace this 2 symbol below from the string
I need a function that will clean a strings' special characters. I do NOT

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.