New example: Server-side processing with pipelining

New example: Server-side processing with pipelining

allanallan Posts: 57,679Questions: 1Answers: 9,193 Site admin
edited April 2009 in General
Hello all,

I've just put together a new example for DataTables 1.5's server-side processing option which will cache information about hidden pages in order to reduce the number of Ajax calls made to the server when using simple paging: http://datatables.net/1.5-beta/examples/server_side/pipeline.html

Basically the modified fnServerData() function will edit the request made to the server, asking for more information than is required. Then when the user requests that the next page be shown, this function will intercept the call the server (it's not needed) and give DataTables the required information from it's cache.

Of course interaction such as filtering or sorting will cause the pipeline to be flushed, but sending a little extra data that might be flushed is cheap compared to making XHR requests for each page to display (typically the most common interaction with a DataTable).

Hope some of you using server-side processing find this useful :-)

Allan

Replies

  • GaryFGaryF Posts: 16Questions: 0Answers: 0
    Interesting. Your demo page shows 50 entries on the first 'page' when using IE7. However, using FF3 it only shows 10 entries on the first 'page'.

    Both browsers show "Show 10 entries" though. Do you have IE7 to hand?
  • GaryFGaryF Posts: 16Questions: 0Answers: 0
    Sorry, forgot to say the concept is really good. Anything to optimise db calls is a good thing. Just need to get my head around your demo code now and maybe spot why IE7 shows 50 rows.
  • allanallan Posts: 57,679Questions: 1Answers: 9,193 Site admin
    Hi Gary,

    Oops - thanks for spotting that. That will teach me for thinking "it's just data processing - what could go wrong in IE...". I wasn't giving 'splice' a second parameter, which is required in IE and Opera (looks like it is in the ECMAScript spec - doh) - add that in as the length of the array to cut off what isn't needed on the the draw allows it to work as expected.

    Allan
This discussion has been closed.