fnReloadAjax and fnDataTablesPipeline

fnReloadAjax and fnDataTablesPipeline

blpraveen2004blpraveen2004 Posts: 15Questions: 2Answers: 0
edited March 2014 in General
fnDataTablesPipeline is not working .I am getting to many errors when I use this function
1)Pipeline is not working. Only loads the data first time. Second time after ajax call retreives the data. No data is loaded to the table
2)I have included a checkbox in each row. Rows selected can be deleted by clicking a button in the toolbar.It does not work when I use Pipeline function
3)After add or delete I use fnReloadData to load the data. which is not working when I use pipeline
[code]
$.fn.dataTableExt.oApi.fnReloadData = function ( oSettings, json, fnCallback, bStandingRedraw )
{
// Server-side processing should just call fnDraw
if ( oSettings.oFeatures.bServerSide ) {
this.fnDraw();
return;
}

this.oApi._fnProcessingDisplay( oSettings, true );
var that = this;
var iStart = oSettings._iDisplayStart;
/* Got the data - add it to the table */
var aData = json;
/* Clear the old information from the table */
var dtbody = oSettings.nTBody;

if($(dtbody).hasClass('row_add')) {
that.oApi._fnAddData( oSettings,aData[0] );
$(dtbody).removeClass('row_add');

} else if (oTable.$('tbody tr.row_edit').length ){
edit_index = oTable.$('tbody tr.row_edit').index();
oTable.$('tbody tr.row_edit').removeClass('row_edit');
trNodes = oSettings.oInstance._fnGetTrNodes(oSettings);
oSettings.aoData[ oSettings.aiDisplay[edit_index] ]._aData = aData[0];
eRow = oSettings.aoData[ oSettings.aiDisplay[edit_index] ].nTr;
for ( var i=0, iLen=oSettings.aoColumns.length ; i

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    fnReloadAjax is meaningless with server-side processing. As its documentation says, just call fnDraw if you are using server-side processing.

    Beyond that, we'd need a link to a test case showing the problem please.

    Allan
  • blpraveen2004blpraveen2004 Posts: 15Questions: 2Answers: 0
    Pipeline is not working properly . I have set the pipe limit to 50. After I go to page 5, even though the ajax is successful it does not load the rows into table

    Here is the working code
    http://shop2build.com/fawaaz/product/tractor-emulsion-smooth-wall-finish-10-lts-2/
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    The pipelining is working just fine, as you can see from my working example.

    The problem is your server-side processing return doesn't meet the requirements. Specifically you are always returning sEcho as 1.

    See the documentation here: http://datatables.net/usage/server-side

    Allan
  • blpraveen2004blpraveen2004 Posts: 15Questions: 2Answers: 0
    What does sEcho value should have when second time ajax is called?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    As the documentation says:

    > An unaltered copy of sEcho sent from the client side. This parameter will change with each draw (it is basically a draw count) - so it is important that this is implemented. Note that it strongly recommended for security reasons that you 'cast' this parameter to an integer in order to prevent Cross Site Scripting (XSS) attacks.

    So simply parse what the client-side sends you as an integer and then send it back.

    Allan
This discussion has been closed.