{hero}

responsive.index()

Since: Responsive 1.0.3

Obtain the cell index from a li details element.
Please note - this property requires the Responsive extension for DataTables.

Deprecated!

As of v2.0.2 this feature has been deprecated. This feature has not yet been scheduled for removal, but its use is discouraged and the alternatives discussed below should be used.

As of DataTables 1.10.11 and Responsive 2.0.2 this method is no longer required to obtain a cell index from a node in the Responsive display as the cell() method will accept the td elements which have dt-row and dt-column data attributes (which is now used by Responsive).

Example

Add a class name to the host cell for data when clicked on):

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

$('#example').on( 'click', 'li', function () {
	$( table.cell( this ).node() )
		.addClass( 'highlight' );
} );

Description

When working with Responsive's details rows it can often be useful to obtain a reference to the cell, row or column that the data shown in the details row comes from. This method provides that ability, returning an object that can be used as a cell-selector with the cell() method.

Note that this method requires the default renderer to be used for responsive.details.renderer. If a custom method is used it will not be able to obtain the information required to calculate the indexes.

Type

function responsive.index( li )

Description:

Calculate the cell index from a li details element

Parameters:
Returns:

Cell object that contains the properties row and column. This object can be used as a DataTables cell-selector.

Example

Add a class name to the host cell for data when clicked on:

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

$('#example').on('click', 'li', function () {
	var cellIndx = table.responsive.index(this);

	$(table.cell(cellIndex).node()).addClass('highlight');
});