rows().indexes()

Since: DataTables 1.10

Get the row indexes of the selected rows.

Description

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.

Type

function rows().indexes()

Description:

Get the rows indexes of the selected rows.

Returns:

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

Example

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

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

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!

Related

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