When I return data from the server, I put total nunber of rows in iTotalRecords property. Is there any function to get this value on the clients side? Something like oTable.fnGetTotalRows... Thanks!
There sure is! This kind of information is stored in the DataTables settings object for each individual table. You can get this object for your table by using the fnSettings() function and there is a function to get the property you specifically want: fnRecordsTotal(). I.e.:
[code]
var oSettings = oTable.fnSettings();
var iTotalRecords = oSettings.fnRecordsTotal();
[/code]
Other functions of interest:
fnRecordsDisplay() - records in the 'display' (i.e. after filtering)
fnDisplayEnd() - End point of the current 'page'
_iDisplayStart - Start point of the current 'page'
_iDisplayLength - Length of records for the current 'page'.
I'm trying to use these settings with an ajaxsource, but the result is 0. I'd like to take the value and show it elsewhere on my page after the table has loaded. Any suggestion?
Replies
There sure is! This kind of information is stored in the DataTables settings object for each individual table. You can get this object for your table by using the fnSettings() function and there is a function to get the property you specifically want: fnRecordsTotal(). I.e.:
[code]
var oSettings = oTable.fnSettings();
var iTotalRecords = oSettings.fnRecordsTotal();
[/code]
Other functions of interest:
fnRecordsDisplay() - records in the 'display' (i.e. after filtering)
fnDisplayEnd() - End point of the current 'page'
_iDisplayStart - Start point of the current 'page'
_iDisplayLength - Length of records for the current 'page'.
Hope this helps.
Regards,
Allan