Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pagination: Server Side or Client Side?

What is it best to handle pagination? Server side or doing it dynamically using javascript?

I'm working on a project which is heavy on the ajax and pulling in data dynamically, so I've been working on a javascript pagination system that uses the dom - but I'm starting to think it would be better to handle it all server side.

What are everyone's thoughts?

like image 389
jrutter Avatar asked Jan 02 '09 20:01

jrutter


People also ask

What is server-side pagination?

Operations and Engineering Dashboards supports server side pagination grid. Server side pagination is considered useful for large-sets of data as the amount of data that is transferred to the client is much smaller than the data handled by the client.

What is client-side paging?

Client Side Pagination means that when a query is made, the server returns to the client all the data in one big chunk. Client Side Pagination is more like going to a restaurant and ordering one of everything on the menu. The time it takes the kitchen to produce all that food is going to be significantly longer.

What is pagination in backend?

Generally, pagination is done by specifying to the user how many results to display per page, and which page of results he is currently viewing. However, backend storage such as MySQL or Solr typically handle pagination by specifying how many results to display per page, and how many results to skip in the output.

What is server-side pagination in angular?

Server-side pagination is a way of controlling a subset of data requests that were fetched from a client-side server, and are useful if we don't want to display all of the data at once. Server-side pagination requires the client to pass in a parameter in order to fetch the relevant information.


2 Answers

The right answer depends on your priorities and the size of the data set to be paginated.

Server side pagination is best for:

  • Large data set
  • Faster initial page load
  • Accessibility for those not running javascript

Client side pagination is best for:

  • Small data set
  • Faster subsequent page loads

So if you're paginating for primarily cosmetic reasons, it makes more sense to handle it client side. And if you're paginating to reduce initial load time, server side is the obvious choice.

Of course, client side's advantage on subsequent page load times diminishes if you utilize Ajax to load subsequent pages.

like image 159
Cory House Avatar answered Sep 20 '22 04:09

Cory House


Doing it on client side will make your user download all the data at first which might not be needed, and will remove the primary benefit of pagination.

The best way to do so for such kind of AJAX apps is to make AJAX call the server for next page and add update the current page using client side script.

like image 25
mmx Avatar answered Sep 18 '22 04:09

mmx