Since: DataTables 1.10

Get the data for the whole table.


This method provides access to the raw data that is used for each row in the tables in the API's context. The result set contains the raw data (be it arrays or objects), with each row defined by an entry in the API's result set. The order of the rows is the row data index (i.e. the order the data was originally read into the table).

If you modify the data contained in the returned array, ensure that you use the rows().invalidate(), row().invalidate() or any of the other invalidation methods to cause DataTables to notice the change and re-read the data source.

Please note that the rows().data() method can also provide full access to this data, but in a more flexible manner as it allows row ordering, paging and searching modifications in the result set through the selector-modifier options object. For example rows({'order':'index'}).data() is exactly the same as data() - both are in data index order, while rows().data() will return the full data set, but in the current display order (as defined by order()).


function data()


Retrieve the data for the whole table, in row index order.


DataTables API instance with the data for each row from the table in the result set.


Show an alert with how many rows of data are in the table:

var table = $('#example').DataTable();

alert( 'There are'' row(s) of data in this table' );

Modify the data and then invalidate the display to redraw:

var table = $('#example').DataTable();

// Increment a counter for each row function (d) {
} );

// Invalidate all rows and redraw


The following options are directly related and may also be useful in your application development.