views:

59

answers:

4

Hi; In an admin panel made with php, what is the best way for paging? ClientSide (jquery) or Serverside ?

+1  A: 

Think again your question: what happens when (and how)?

Client side:

To achieve client side pagination you should serve all rows (data) to your client because at this time you haven't any info about which page needed. Then with the help of a (possibly) javascript solution splitting all of the served data into smaller chunks mimicking pagination.

Server side:

You should serve only the first (or actual) page.

I'd go with server side pagination of course.

fabrik
+2  A: 

Short answer, yes.

A bit longer answer, it depends on what you are pageing

If you are pageing large amounts of data, I'd go with a combination, using ajax to fetch the data and letting PHP sort out which data should be sent.

If you are simply pageing a couple of panels with controls I'd just do it with javascript, but thats my personal preference.

For 9/10 solutions, go with whatever you are more comfortable with.

Kristoffer S Hansen
yes - answer for what? He asked "what is the best way" :)
fabrik
...it was pretty humorous when it was in my head :(
Kristoffer S Hansen
+1  A: 

It depends on several factors: (incomplete list)

  • How often do people want to see other pages than the first?
    • If they often browse around you'd want the interaction to be entirely on the client => instant feedback.
    • If, OTOH, the rest of the pages are seldom used there's no reason to send it to the client in the first place.
    • I.e., send what most users want, nothing more.
  • How big is the total data set?
  • How do you weight initial load time (higher with client side) vs. time to serve a new page (higher with server side)?
  • ...

I'd go for server side, but:

  • Serve first page only, thus minimizing initial load time
  • Fetch other pages, when requested, via AJAX - serving only what's necessary in order to minimize the "page" load time

And it's an admin panel, so you should really follow @Kristoffer S Hansen's advice: Do whatever you're more comfortable with.

jensgram
+1  A: 

Your decision will depend on how the data is likely to be used.

When a user is on that page, are they likely to stay the first page of results most of the time? In that case, server side paging works well, as you only go through the trouble of assembling that one page of data.

Or are they likely to constantly page back and forth through the results? In that case, you might as well build all the results efficiently in single shot and let the client do the paging, since you're going to need all the data eventually anyway.

TickleMeElmo