How to get total rows

How to get total rows

adromiladromil Posts: 53Questions: 4Answers: 0

I have been using dataTables for quite sometime starting from version 1.6.4,

I have known that using oTable.fnSettings().fnRecordsTotal() will return the number of rows there are in the table.
However though, having updating to 1.10.1 I don't find any documentation that will provide me the same result.

Hoping for your inputs

Best regards

This question has an accepted answers - jump to answer

Answers

  • tester1tester1 Posts: 53Questions: 14Answers: 1

    //get the number of rows in total

    $total_query = mysql_query("SELECT COUNT(id) FROM {$table} ")
    or die(mysql_error());
    $row = mysql_fetch_array($total_query);
    $response['iTotalRecords'] = $row[0];

  • adromiladromil Posts: 53Questions: 4Answers: 0
    edited July 2014

    Thank you your for your response, however, what I need is a return using dataTables API. It is tedious if I am going to use AJAX and get the return. It is more appropriate if I will get the number of rows the dataTable using sever-side source in dataTables' function API in javascript.

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    Answer ✓

    Use page.info().

    Allan

This discussion has been closed.