How to enjoy both Server-Side paging, and Client-Side sorting/filtering etc.

How to enjoy both Server-Side paging, and Client-Side sorting/filtering etc.

shayeshaye Posts: 1Questions: 0Answers: 0
edited June 2012 in General
Hi,
I am using datatables for a large DB (which means ServerSide processing is a must).
On every page I am displaying 50 records, and on page-changes I am fetching the next 50 records from the server.
Up to here, everything works fine.

when I'm clicking on a column header to try and sort, instead of sorting the 50 records on the clientside (directly from the DOM), datatables makes another AJAX call for the server, asking it to provide the current page sorted by field 'X'.

If I turn off server-side processing, datatables expects the server to give it (datatables) all the data, and it will handle all the sorting/paging on client-side, but, because of the massive amount of records the browser collapses... :(

Isn't there a way to combine Server-Side processing for paging and fetching part of the records every time, and use DataTables to sort just the records displayed on each page on the client side??

Thanks in advance,
Shay

Replies

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin
    There is no way in DataTables to have mixed mode processing. Consider for example the case where you filter on a string that has no results on the client-side, but lots of results on the rest of the data at the server side. You would incorrectly tell the end user that there are no results!

    How many rows are you working with - if <50'000, then have you considered using client-side processing with deferred rendering enabled?

    If >50'000, then yes, server-side processing is going to be requires, and needs to implement all of the features you want (including sorting and filtering).

    Allan
This discussion has been closed.