سؤال

I want to check the iTotalDisplayRecords of a jQuery dataTable. The data is already loaded and everything is initialized fine, but I'd like to pull the value of iTotalDisplayRecords from the dataTable object. How do you do this? What attribute or function of the dataTable object do you call?

هل كانت مفيدة؟

المحلول

Jons answer does only work with dataTables version 1.10.x and above. For other versions, eg 1.9.x use

var dataTable = $('#example').dataTable();
var iTotalDisplayRecords = dataTable.fnSettings().fnRecordsDisplay();

demo -> http://jsfiddle.net/8CKjH/

نصائح أخرى

Use the page.info() API:

var dt = $('#table').DataTable();
var iTotalDisplayRecords = dt.page.info().recordsDisplay;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top