The fnServerData function is being called multiple times to load one table, Why?
The fnServerData function is being called multiple times to load one table, Why?
AverageGuy
Posts: 5Questions: 0Answers: 0
Everything works but I've noticed that it's making 8 trips to my php file for data even though the returned data is identical except for the sEcho parameter. The number 8 doesn't correspond to anything I can find. There are 11 columns and 30 rows.
The definition looks like:
[code]
oTable = $('#example').dataTable( {
"bServerSide": true,
"sAjaxSource": 'getSortData.php',
"bAutoWidth": false,
"fnServerData": function ( sSource, aoData, fnCallback ) {
// aoData.push( { "name": "more_data", "value": "my_value" } ); // this line will give additional data to the server...
console.log("Load called",ncalls);
ncalls++;
$.postJSON( sSource, aoData, function (json) {
/* Do whatever additional processing you want on the callback, then tell DataTables */
fnCallback(json)
} );
}
} );
oTable.fnSort( [ [0,'asc']] );
[/code]
which I borrowed from some example somewhere.
I'm just trying to improve the performance, if possible.
There are a few other references to oTable in the js but I put console.log statements at each one and non of them are executed at document load time.
Thanks,
Jim.
The definition looks like:
[code]
oTable = $('#example').dataTable( {
"bServerSide": true,
"sAjaxSource": 'getSortData.php',
"bAutoWidth": false,
"fnServerData": function ( sSource, aoData, fnCallback ) {
// aoData.push( { "name": "more_data", "value": "my_value" } ); // this line will give additional data to the server...
console.log("Load called",ncalls);
ncalls++;
$.postJSON( sSource, aoData, function (json) {
/* Do whatever additional processing you want on the callback, then tell DataTables */
fnCallback(json)
} );
}
} );
oTable.fnSort( [ [0,'asc']] );
[/code]
which I borrowed from some example somewhere.
I'm just trying to improve the performance, if possible.
There are a few other references to oTable in the js but I put console.log statements at each one and non of them are executed at document load time.
Thanks,
Jim.
This discussion has been closed.