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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:57:39+00:00 2026-05-30T01:57:39+00:00

* EDIT * To clear things up. I’m able to show and hide. That’s

  • 0

* EDIT *
To clear things up. I’m able to show and hide. That’s not an issue. What I’d like to do is completely rebuild the table rows based off the class. When I initially come in, the table could potentially have thousands of rows. They’ll all have a class of ‘both’, ‘option1’ or ‘option2’. I have to only show 5 of these at a time and page through them based off first, previous, next, last button clicks. However, it becomes incredibly challenging when some of the table rows should show and some should not.

So I’d like to have, essentially, 3 arrays to rebuild my table html from. One would have all rows, one with Option1 rows and one with Option2 rows.

Hopefully that’s a little more clear.
* END EDIT *

I have a table that is built and immediately has all the rows hidden. Then, depending upon a radio button click event, I show the first 5 rows of the table with the given criteria.

There are only 3 options (Both, option 1 or option 2). Each is built into the class on the TR.

For the simplification of paging, I’d like to filter my results into 3 arrays. 1 for all, 1 for option 1 and 1 for option 2, then just replace the tbody with the rows.

I have the following code, that’s not working correctly:

var trHTML = $("#resultsBody").html();
var newTable = trHTML.filter(function() { return $(this).css("display") == "none" })
$('#resultsBody').empty().append(trHTML);

With the following HTML (selection):

<div id="edit-network" class="form-radio">
  <div class="form-item form-type-radio form-item-network">
    <input id="edit-network-all" class="form-radio" type="radio" name="network" value="all" checked="checked">
    <label class="option" for="edit-network-all">All </label>
  </div>
  <div class="form-item form-type-radio form-item-network">
    <input id="edit-network-access" class="form-radio" type="radio" name="network" value="access">
    <label class="option" for="edit-network-access">Access </label>
  </div>
  <div class="form-item form-type-radio form-item-network">
    <input id="edit-network-select" class="form-radio" type="radio" name="network" value="select">
    <label class="option" for="edit-network-select">Select </label>
  </div>
</div>

With the following HTML (table):

<div class="result">
  <table id="results" width="100%" summary="Dentist search results" title="Dentist search results">
    <tbody id="resultsBody">
      <tr id="row1" class="both odd" style="display: table-row;">
        <th id="this-data">Heading</th>
        <th id="that-data">Heading</th>
        <th id="other-data">Heading</th>
      </tr>
      <tr id="row2" class="option2 odd" style="display: table-row;">
        <td headers="this-data">something</td>
        <td headers="that-data">more data</td>
        <td headers="other-data">other data</td>
      <tr id="row3" class="option1 odd" style="display: table-row;">
      <tr id="row4" class="both odd" style="display: table-row;">
      ...
      ...
      <tr id="row100" class="both" style="display: none;">
    </tbody>
  </table>
</div>

Any suggestions? A plug-in isn’t the solution. This needs to work to a very specific design spec, so I’m working only with the guts of this beast.

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-30T01:57:39+00:00Added an answer on May 30, 2026 at 1:57 am

    * EDIT *

    Returning all your results to the browser and then implementing paging on the screen is not paging, and defeats the whole purpose of it.

    You should post “option1” / pageNum / pageCount, select the top 5 (pageCount) that are in between your page number and page count, and then return that to the browser. No javascript trickery necessary.

    Then when clicking next or prev you can +/- the pageNum.

    If you still want to continue down the path of client side paging I’ve updated my example code to something closer, modify as needed. It will be slow over large sets of data…

    * END EDIT *

    function(selectedValue, pageNum, pageCount) {
        var recordsSkipped = 0;
        var numShown = 0;
    
        $("#resultsbody tr").each(function(){
            if(recordsSkipped >= (pageNum - 1) * pageCount 
               && numShown < pageCount 
               && ($(this).hasClass(selectedValue) || $(this).hasClass("both"))) {
    
                $(this).show();
                numShown++;
            }
            else {
                $(this).hide();
                recordsSkipped++;
            }
        };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: Just to make things clear, this problem was caused by a typo in
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
RESOLVED EDIT: Because it is not clear through the discussion nothing was really wrong
Edit: This question was written in 2008, which was like 3 internet ages ago.
Edit: From another question I provided an answer that has links to a lot
EDIT What small things which are too easy to overlook do I need to
Edit : Solved, there was a trigger with a loop on the table (read
Edit: I'm rewriting this question because I apparently wasn't clear. Sometimes the GPS service
If I have the following code (EDIT: Sorry if I wasn't clear, I want
Edit: Of course my real code doesn't look exactly like this. I tried to

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.