Adding another data along to iTotalRecords
Adding another data along to iTotalRecords
Hi there,
On the serveur side, i'm calculating a sum and i'm trying to get it back and using it (sum of a column - not only the displayed lines but all the returned lines).
So I added a iTotalAmount value along with iTotalRecords, but i can't manage to read it with javascript.
How can i do it ?
I tried a few times using fnServerData or fnFooterCallback without success.
Thanks.
On the serveur side, i'm calculating a sum and i'm trying to get it back and using it (sum of a column - not only the displayed lines but all the returned lines).
So I added a iTotalAmount value along with iTotalRecords, but i can't manage to read it with javascript.
How can i do it ?
I tried a few times using fnServerData or fnFooterCallback without success.
Thanks.
This discussion has been closed.
Replies
I'm not quite 100% clear on what you need to do here, but if you want to pass back extra information (along with the information required by DataTables - http://datatables.net/usage/server-side ) you can do it with a custom calling function (fnServerData). Something like:
[code]
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "../examples_support/server_processing.php",
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.getJSON( sSource, aoData, function (json) {
/* Do whatever additional processing you want on the callback, then tell DataTables */
document.getElementById('whatever') = json.whatever; // etc
fnCallback(json)
} );
}
} );
} );
[/code]
Regards,
Allan