Since: DataTables 1.10

Get the row indexes of the selected rows.


DataTables stores the data for rows and columns in internal indexes for fast ordering, searching etc. It can be useful at times to know what these indexes are, as they can be used for efficient selectors in the row(), column() and other API methods which use selectors.

This method is used to retrieve the indexes of the selected rows which can then be used as part of a selector to update data.


function rows().indexes()


Get the rows indexes of the selected rows.


DataTables API instance with selected row indexes in the result set.


Use the indexes in a rows selector to get the data:

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

var rows = table.rows('.selected').indexes();
var data = table.rows(rows).data();

// Note that you could use `table.rows( '.selected' ).data() here as well!
// This is just an example showing how indexes can be used!


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