Paging Logic In Javascript?

P

pbd22

Hi.

I have writting all of my paging logic in javascript.
It works pretty fine. Basically, I have created a
gridview with full paging in javascript. Now, given
a certain need, I am being advised to do my paging
on the server.

My question: is there a performance cost by doing
all my paging server-side (and cost benefit by keeping
it on the client). Or, does it matter?

Thanks!
 
C

Cah Sableng

My question: is there a performance cost by doing
all my paging server-side (and cost benefit by keeping
it on the client). Or, does it matter?

CMIIW.
I would recommend to do your pagination logic at server-side, then
javascript to do request paging (ajax + json recommended) and some
fashion.
The page size will be reduced, and the page loads faster (especially
in web page). The server performance will be increased too, because it
generates smaller page.

Few months ago, I got complain from user accessed around 250 rows on a
single page. More than 2 minutes until the page shown on P2 CPU. The
page is in an intranet application, and it use javascript to stripe
colors, fits each column width, etc, but no ajax.
Under development process, the data just about 30 rows and I didn't
think to do any pagination.

HTH
 
M

Matt Kruse

I would recommend to do your pagination logic at server-side, then
javascript to do request paging (ajax + json recommended) and some
fashion.

The down-side is that those without js support will not be able to
change pages. Or if you build in a fall-back, then they are refreshing
the entire page each time, which may be annoying.

If the whole result set isn't too big, then you can dump it down as
one single long table and use script to auto-paginate it. Those
without js will see a long table, those with js will see a client-side
paging table.
Example: http://www.JavascriptToolbox.com/lib/table/
Few months ago, I got complain from user accessed around 250 rows on a
single page. More than 2 minutes until the page shown on P2 CPU.

For 250 rows? I would say something is definitely wrong...
page is in an intranet application, and it use javascript to stripe
colors, fits each column width, etc, but no ajax.

Perhaps your script was slow and the results could be much improved
for the user.

Matt Kruse
 
C

Cah Sableng

For 250 rows? I would say something is definitely wrong...


Perhaps your script was slow and the results could be much improved
for the user.

The page is a printer-friendly script. The script is responsible to
measure the height of entire page then remove all elements. Then
divide pages into div with page-break based on paper size user
entered. It was using cross-browser library to do the dirty job rather
than scripting all in self-made javascipt. Tested on user's P2 CPU,
the performace is poor. Perhaps I should make replacement of cross-
browser's functions to increse performance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top