fnReloadAjax and fnDataTablesPipeline
fnReloadAjax and fnDataTablesPipeline
blpraveen2004
Posts: 15Questions: 2Answers: 0
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
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
This discussion has been closed.
Replies
Beyond that, we'd need a link to a test case showing the problem please.
Allan
Here is the working code
http://shop2build.com/fawaaz/product/tractor-emulsion-smooth-wall-finish-10-lts-2/
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
> 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