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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:41:42+00:00 2026-05-30T16:41:42+00:00

I have a multiple html tables on a page which each have a header

  • 0

I have a multiple html tables on a page which each have a header row. When I click that column header it should sort all tables by that column. The column that I am specifically referring to contains an anchor which for text displays a integer value.

When I click the column header I am experience an incorrect sort. Assume I have the following on this screen load:

83
84
104

Now I click the column header the end result becomes:

104
83
84

I have the code written to alternate the sort on the next click and what happens is that the 104 and 84 pivot around the 83. What I believe is happening is that it is comparing these incorrectly. I have tested it with larger data sets and the problem comes up when any of the numbers do not share a common number of digits.

Is there anything (maybe a flag I’m missing?) to tell this thing to sort it correctly? All of my more string-like data sorts correctly.

Code:

<html>
<head>
    <script type="text/javascript" src="jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="jquery.tinysort.min.js"></script>
    <script language="javascript">
    var aAsc = [];
    $(".SubHead").click(
        function() {
            var nr = $(this).index();
            aAsc[nr] = aAsc[nr]=='asc'?'desc':'asc';
            $('.resultTable>tbody>tr:not(.SubHeadRow)').tsort("td:eq("+nr+")",{order:aAsc[nr]});
       }
   );
    </script>
</head>
<body>
    <table class="resultTable" border="1">
        <tr class="SubHeadRow">
            <td class="SubHead">
                <a href="#">ID</a>
            </td>
            <td class="SubHead">
                <a href="#">Application Header</a>
            </td>
            <td class="SubHead">
                <a href="#">Version Header</a>
            </td>
        </tr>
        .
        .
        .
    </table>
    .
    .
    .
</body>

Edit:
This is the link for the plugin: http://tinysort.sjeiti.com/

Above I ammended the code to include a sample of what the html looks like. I’m not infront of it so it may not be 100%. Not that I suspect it is important but the tables are dynamically created in ColdFusion 7MX.

  • 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-30T16:41:43+00:00Added an answer on May 30, 2026 at 4:41 pm

    Ok,

    I answered my own question. Reviewing the TinySort site this morning I noticed an area dedicated to this. After spending hours focusing on this feature it’s easy to see how it was overlooked. The answer is at http://tinysort.sjeiti.com/ under parsing a custom sort function with some minor tweaking.

    I created a custom case for the integer column and passed a custom comparator function. See below:

    var aAsc = [];
    $(".SubHead").click(
        function() {
            var nr = $(this).index();
            aAsc[nr] = aAsc[nr]=='desc'?'asc':'desc';
            if(nr == 0){
                $('.resultTable>tbody>tr:not(.SubHeadRow)').tsort("td:eq("+nr+")", 
                    {
                        sortFunction:function(a,b) {
                            var order = (aAsc[nr]=='asc')?1:-1;
                            var i = parseInt(a.s);
                            var j = parseInt(b.s);
                            if( i===j ){
                                return 0;
                            } else {
                                return (i > j)?order:-1*order;
                            }
                        }
                    }
                );
            } else {
                $('.resultTable>tbody>tr:not(.SubHeadRow)').tsort("td:eq("+nr+")",{order:aAsc[nr]});
            }
        }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form on an HTML page with multiple submit buttons that perform
I have multiple tables on my page that contain a checkbox. Immediately following the
I have multiple html tables. Each table has the same number of columns but
I have multiple data tables per page, ranging from 4 to 8 ish. All
I have a HTML table that displays rows of records and has a column
I have a database that has two tables, one of which contains a foreign
Tables in HTML can have footers : <TABLE> <THEAD><TR><TD>Your header goes here</TD></TR></THEAD> <TFOOT><TR><TD>Your footer
I have an HTML table of data where each cell can have multiple lines
I have a table with multiple TD's, all of which have the id=changeMe <td
I have a HTML form, which includes radio buttons that the user can select

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.