View Full Version : "Show More..." Link after table

06-23-2010, 04:14 AM
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


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.

Old Pedant
06-23-2010, 04:17 AM
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.

06-23-2010, 04:21 AM
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:


But is that the best way?

Old Pedant
06-23-2010, 04:50 AM
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?