Load first N pages on server-side tables
Load first N pages on server-side tables
chinapot
Posts: 7Questions: 3Answers: 0
Hi,
On a server-side table, I want to initialize a table with the first 3 pages. The deferLoading property allows you to skip the loading of the first elements, before doing a Ajax call. But I'm not being able to paginate the already loaded elements.
For example, I want to load 30 elements and display it it in pages of 10 elements. Then, the 4th page would trigger the Ajax call.
Is there a way to achieve this behaviour ?
Thanks
This discussion has been closed.
Replies
I'm not familiar with the deferLoading. I'm just curious though, why use this over the server-side script implementation? You can have pages of 10, with 1 million total rows and it will load every page instantly. It is very nice because the table will always act as though you have all 1 million rows loaded at all times, even though you only load 10.
I do not want to use it over the server-side implementation. I want to use it as an improvement to it. As a matter of fact, right now we're using server-side with defered loading of the first page (we load 10 records and build the table, when the user goes to the second page, the datable loads (via Ajax) the next page, and so on.. ).
Now, imagine a scenario where the (computational / memory / time) cost of doing a query for the data is very high, but whether you retrieve 10 or 1000 records it's more or less the same.
When you get to the page where the table is loaded, you want to display some set of results. As said, you can load the first 10 records and doing a "normal pagination", but we'd like to load the first 30 records, but still display it with 10 elements per page. If the user navigated to the second page, the data would already be loaded and the page would be displayed as-in client-side pagination. The same for the third page. If the user reached the 4th page, then it would trigger the Ajax call to get the server-side loaded data.
For the end-user, everything would be invisible (except that the second and third page would load way faster than the next ones). But we're assuming that most users won't navigate a lot through pagination.
Take a look at the pipelining example which it sounds like what you want.
Allan
It sounds and it looks like what I want. I actually had achieved it with some other tweaks, but that appears to be a cleaner way. I'll try it.
Thanks, allan.