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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:19:31+00:00 2026-05-14T08:19:31+00:00

I a couple of issues using Tablesorter 2.0.3. The first issue is when I

  • 0

I a couple of issues using Tablesorter 2.0.3.

The first issue is when I set a colspan on my table. Basically when I do this as below it doesn’t sort the respective columns.

<table> 
<thead> 
        <th colspan="3"></th>  
        <th>Four</th> 
        <th>Five</th>
        <th>Six</th>
        <th>Seven</th>  
</thead> 
<tbody> 
<tr> 
        <td>1</td> 
        <td>2</td> 
        <td>3</td> 
        <td>4</td>
        <td>5</td> 
        <td>6</td>
        <td>7</td>
</tr>  
</tbody> 
</table> 

The second issue I have is that no matter what I set the sortInitialOrder (“desc” or “asc”) in the tablesorter.js, it doesn’t have any effect to making the sort ascending or descending when it is clicked on.

Please can anyone help?

  • 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-14T08:19:32+00:00Added an answer on May 14, 2026 at 8:19 am

    To solve problem one you can create your own mapping of headers to data cols. here’s what I did to get the functionality the way I wanted.

    I’ve added the following method to tablesorter.js:

    function findInMap(map, index, reverse) {
        for(var i = 0; i < map.length; ++i) {
            if(map[i][reverse ? 1 : 0] == index) return map[i][reverse ? 0 : 1];
        }
    
        return index;
    }
    

    And also added the following to this.defaults

    customMap: []
    

    The, change the following method:

    function setHeadersCss(table,$headers, list, css) {
        $headers.removeClass(css[0]).removeClass(css[1]);
    
        var h = [];
        $headers.each(function(offset) {
            if(!this.sortDisabled) {
                h[this.column] = $(this);                   
            }
        });
    
        var l = list.length; 
    
        for(var i=0; i < l; i++) {
            var header = list[i];
            var headerIndex = findInMap(table.config.customMap, header[0], true);
            h[headerIndex].addClass(css[header[1]]);
        }
    }
    

    Last but not least, add/change the following in $headers.click(function(e) {

    Add:

    var ia = findInMap(config.customMap, i, false);
    

    Change:
    config.sortList.push([i,this.order]); To config.sortList.push([ia,this.order]);

    When you init the tablesorter pass a customMap[[header_col_id, data_col_id]] In your case it’ll be:

    customMap[
        [2, 4],
        [3, 5],
        ...
    ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok so I've spent a couple hours trying to resolve this issue and have
I am having a couple of issues deciding how best to describe a certain
I'm using nokogiri to select the 'keywords' attribute like this: puts page.parser.xpath(//meta[@name='keywords']).to_html One of
Hey guys, I'm using GWT for a data-driven web application, and I'm having issues
SSIS Hello. Firstly excuse me if this doesn’t make a lot of sense as
A couple of months ago I've coded a tiny tool that we needed at
A couple of days ago, I read a blog entry ( http://ayende.com/Blog/archive/2008/09/08/Implementing-generic-natural-language-DSL.aspx ) where
A couple of the options are: $connection = {my db connection/object}; function PassedIn($connection) {
A couple of weeks ago, my piano teacher and I were bouncing ideas off
A couple of recent questions discuss strategies for naming columns, and I was rather

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.