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

  • Home
  • SEARCH
  • 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 4055128
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:39:44+00:00 2026-05-20T14:39:44+00:00

Hi I am using a table manipulation (sorting) script taken directly from Learning jQuery

  • 0

Hi I am using a table manipulation (sorting) script taken directly from Learning jQuery 1.3 and I have my own script running which initally limits the table rows displayed to 10 :

JavaScript

$(document).ready(function () {
$('#table_wrapper').removeClass('top_noround');
var numShown = 10; // Initial rows shown & index
var numRows = $('tbody').find('tr').length; // 7
var numLeft = numRows - numShown;

// Hide rows and add clickable div
$('#table_wrapper tbody').find('tr:gt(' + (numShown - 1) + ')').hide().end()
$('#table_wrapper').after('<div id="more"><a>Show all free bet offers <span>(' + numLeft + ' more)</span></a></div>');


$('#more').toggle(

function () {
    numShown = numShown + numRows;
    $('tbody').find('tr:lt(' + numShown + ')').show();
    $("#more a").html("Show top 10 offers");
}, function () {
    numShown = 10;
    $('tbody').find('tr:gt(' + (numShown - 1) + ')').hide();
    $('#more a').html('Show all free bet offers <span>(' + numLeft + ' more)</span>');
    $(window).scrollTop($('th').offset().top);
});

})

HTML

<div id="table_wrapper" class="top_noround">
    <table class="sortable jquery-thead">
        <thead>
            <tr>
                <th>
<!--Empty, no sort on this column-->
                </th>
                <th>
<!--Empty, no sort on this column-->
                </th>
                <th class="sort-numeric ">
                    <a class="button blue small">
                        Column 3 
                    </a>
                </th>
                <th class="sort-numeric">
                    <a class="button green small">
                        Column 4 
                    </a>
                </th>
                <th class="sort-numeric">
                    <a class="button magneta small">
                        Column 5 
                    </a>
                </th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>
                    Row 1 Column 1 Data
                </td>
                <td>
                    Row 1 Column 2 Data
                </td>
                <td>
                    Row 1 Column 3 Data
                </td>
                <td>
                    Row 1 Column 4 Data
                </td>
                <td>
                    Row 1 Column 5 Data
                </td>
            </tr>
            <!--MORE ROWS HERE (OVER 10) -->
        </tbody>
    </table>
</div>

The problem I am having is that if I click on the thead on the column I want to sort it will only resort the 10 rows displayed, it does not take into account the other rows that extend below 10 rows which are currently hidden as a result of my script. If I click to show all rows of the table and then sort that is working fine.

Thanks

  • 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-20T14:39:45+00:00Added an answer on May 20, 2026 at 2:39 pm

    I would recommend that you use jQuery tablesorter and the pages plugin. There is a good example on there webpage. You can show X many rows but when you sort the data you will sort all of it not just whats visible.

    I only show the pager if there are more then 10 rows of data, to do this I use a helper function in my main JavaScript file that I run on document ready.

    function pager ($table, $pager) {
        if ($table.find('tbody tr').length > 10) {
            $table.tablesorterPager({ container: $pager });
            $pager.show();
        } else {
            $pager.hide();
        }
    }
    
    $(document).ready(function () {
        $("table.tablesorter").tablesorter();
        pager($("table.tablesorter"), $("#pagerId"));
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JTable which is loaded from a data-structure using table model.The data-structure
I'm using the table class that auto-generates a table for me from an array
Does anyone have an example using the table object in YUI library. More specifically,
I am trying to INSERT INTO a table using the input from another table.
I'm using SQL Server 2000 to print out some values from a table using
I am pulling data from one table, called analyzedCopy, and using it to over-rite
What are the pros and cons of using table aliases in SQL? I personally
In SQLSERVER 2005, I'm using table-valued function as a convenient way to perform arbitrary
I'm using a table to design the layout of my web page. I want
I'm using a table adapter in Visual Studio to make a query to a

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.