DataTables server-side processing with pipelining - Can you help me to understand ?

DataTables server-side processing with pipelining - Can you help me to understand ?

anueliconanuelicon Posts: 5Questions: 1Answers: 0
edited April 2009 in General
Hi, I don't understand the example with pipelining ... How can I integrate in my code.
This is my javascirpt

oTable = $('#std_table').dataTable(
{
"bProcessing": true,
"bServerSide": true,
"bAutoWidth" : false,
"aoColumns": [
/* Id */ {"bSearchable": true,
"bVisible": true,
"bSortable" : false},
/* name */ null,
/* name */ null,
/* Associated Users */ {"sClass": "center",
"sType": "numeric",
"bSortable" : false
},
/* Is role */null,
/* Date Creation */ {"sClass": "center",
"sType": "date" }
],
"aaSorting" : [[5, "desc"]],
"sAjaxSource": "http://localhost/index.php/admin/ajax_call_grid_roles_table",

"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
}
} );


Works very well !!
But still in pre-production zone, and the ajax calls for filtering, pagination, ordering may generate a DOS ...
Where I coul'd place your example ? I have fnServerData already customized with an ajax POST call.

And ... in the Initialisation code there is at the top

$('#exampvar oCache = {
iCacheLower: -1
};

Is there an error in these 3 line of code ?

Thanks a lot !!

Replies

  • allanallan Posts: 57,679Questions: 1Answers: 9,193 Site admin
    Hi anuelicon,

    As stated in the example, the pipelining only works for pagination. The reason for this is that pagination is (typically) the most common user interaction with the table - therefore there is an obvious opportunity to reduce the number of comms sessions between the client and server. The paging is easy to predict on the client-side, page 2 must follow page 1 for example!

    However, when you start doing filtering, sorting etc the client-side has absolutely no idea what the data might be on the server - so an XHR is needed. If you want to avoid this then you should load all of the information into the client-side, which of course has the down-side that the more rows you add, the more processing the browser needs to do (and is therefore slower).

    Regarding your oCache variable - yes there is an error here. I'm not sure what you are actually trying to achieve here. You don't need any jQuery to declare this variable. Try something like:

    [code]
    var oCache = {
    iCacheLower: -1
    };
    [/code]

    Hope this helps,
    Allan
This discussion has been closed.