Equivalent of oTable.fnSettings().fnRecordsDisplay()

Equivalent of oTable.fnSettings().fnRecordsDisplay()

BabyAzertyBabyAzerty Posts: 4Questions: 0Answers: 0
edited April 2014 in DataTables 1.10
I don't see how to get the recordsDisplay with the new API ? Is there a direct way ?
By the way, my table's data is dynamic (ajaxed)

Thanks

Replies

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    This information so now available in the public API: http://next.datatables.net/reference/api/page.info() (you'll need to add the `()` to the URL - sorry. I've not yet updated the auto linker!

    Allan
  • BabyAzertyBabyAzerty Posts: 4Questions: 0Answers: 0
    edited April 2014
    Thank you Allan.

    However, it doesn't work and always shows 0.
    My #table does an ajax request, and I want to get the new total records.

    [code]
    $('#table').on('xhr.dt', function(e, settings, json) {
    console.log(json.recordsTotal); //(Meanwhile method that works)
    console.log($('#table').DataTable().page.info()); //Always 0 for all the value but length (=10)
    });
    [/code]

    With a static table, no problem.
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    The page length is set after the `xhr` event, so the paging info will be one step behind there. Try listening for the `draw` event which is fired immediately after the draw.

    Allan
This discussion has been closed.