Since: DataTables 1.10

Get the data for the selected rows.


This method is used to get the data used for the cells in the rows matched by the selector from DataTables.

The order of the data in the returned array and which rows the data is obtained from (searched rows, visible rows etc) is controlled by the selector-modifier option of the rows() selector used to get the selected rows.

This method cannot be used to modify data in the table, only to retrieve it. Use the row().data() method instead which can be used as a setter.


function rows().data()


Get the data for the rows from the selector


DataTables API instance with data for each row from the selector in the result set. Each entry is the original data source object for that row, be it an array, object or Javascript object instance.


Get all data from the table:

var table = new DataTable('#myTable');

var data = table.rows().data();

alert('The table has ' + data.length + ' records');

Using a data object instances as the data source:

var pupils = [new Pupil(), new Pupil(), new Pupil(), new Pupil()];

// Create table with data set
var table = new DataTable('#myTable', {
	data: pupils

var rows = table.rows(0).data();

alert('Pupil name in the first row is: ' + rows[0].name());


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