Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    "Show More..." Link after table

    First I have a performance question.

    Which would be better:

    Load a full table from the database first and display a portion with a "Show More..." link

    --OR--

    Load just the small portion with a "Show More..." link and then do an ajax call to load the rest of the table?

    And secondly, I sort of know how to do the second option but it can get a bit complicated. You need to know the offset of which to search a database to load the rest. and the "append" that to the table.

    If I do the first option, it seems a bit more easier but I can't seem to come up with the logic. How would I truncate a table showing only a few entries and have the rest of the table hidden while having a link that shows the rest of the table when clicked? Thanks in advance.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,869
    Thanks
    79
    Thanked 4,418 Times in 4,383 Posts
    First question: How many *total* records are we talking about???

    If you have more than a couple of thousand records, total, you certainly don't want to load them all into the page and then use just JS to display parts. You'd clearly want to use AJAX. Or maybe just bite the bullet and do a full post back to the server to get the next page.

    But it's pretty easy, if the total number of records is reasonable. Several ways to do it, actually.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's the problem. Sometimes there will be thousands of records in a table but I'm pretty sure I don't want to display all of them on one page because that will look terrible.

    For the sake of it, lets just say the most that will be returned would be about 50.

    The problem I have is "appending" the hidden results to the given table. I know I can use jquery to do something like:

    Code:
    $("tr").show();
    But is that the best way?

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,869
    Thanks
    79
    Thanked 4,418 Times in 4,383 Posts
    Do you really want to *append* them? Or do you want to "page" them??? Usually, we use paging. See Google for an example. They show you N results and then you click "next" (or a page number) to see more.

    Most people are used to that kind of interface (they must be, or Google wouldn't be using it <grin/>), so why would you want to invent a different wheel?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •