checking itotalRecords

checking itotalRecords

DB_UKDB_UK Posts: 2Questions: 0Answers: 0
edited April 2011 in General
I would like to check the iTotalRecords variable returned by the server when I validate the form that my datatable is on. Is this stored in a global variable that I can access?

Thank you.

Replies

  • allanallan Posts: 63,519Questions: 1Answers: 10,473 Site admin
    You can use fnServerData to 'intercept' the data coming back from the server. Something like this: http://datatables.net/examples/server_side/post.html . Rather than just using fnCallback for the success though - you would want to have an anon function which will look at the JSON return, do whatever logic you need, then call fnCallback.

    Allan
  • DB_UKDB_UK Posts: 2Questions: 0Answers: 0
    Allan

    Thank you, your suggestion worked:

    [code]
    ...
    "fnServerData": function ( sSource, aoData, fnCallback ) {
    $.getJSON( sSource, aoData, function (json) {
    $('#currentAllocations').val(json.iTotalRecords);
    fnCallback(json)
    });
    );
    [/code]
This discussion has been closed.