Since: DataTables 1.10

Get index information about the selected cell.


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.

Usefully, this method also provides the visible column index as well as the column data index, as columns can be added and removed from the document dynamically.

The data structure returned for the cell in the result set, selected by cell() is:

    "row":           integer, // Row index
    "column":        integer, // Column data index 
    "columnVisible": integer  // Column visible index


function cell().index()


Get row, column and visible column index information


Object with index information for the selected cell. See below for the object structure.


Alert the visible column index (count) for the cell clicked on:

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

table.on('click', 'tbody td', function () {
		'Clicked on cell in visible column: ' +

Use row index in a row selector to add a class to the clicked on row:

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

table.on('click', 'tbody td', function () {
	var rowIdx = table.cell(this).index().row;



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