{hero}

cell().cache()

Since: DataTables 1.10

Get the DataTables cached data for the selected cell.

Description

DataTables caches data for searching and ordering in order for those operations to run as quickly as possible when they are required. Sometimes it can be useful to get the data that DataTables has cached for these operations, access to which is provided by this method.

Cached data is not guaranteed to be available at any particular moment. If DataTables hasn't requested the data, it won't have been cached. This is particularly obvious when using the order option and a sort hasn't been performed on a column. Invalidation of data will also cause the cache to be removed.

It should be noted that this method is required as DataTables has the ability to use different data for its different operations (searching, ordering, display etc) - see columns.data and columns.render for further information. cell().data() provides access to the original data. If you aren't using orthogonal data for the different operations of DataTables, then this method is of limited used.

Note that this method is primarily aimed at plug-in developers who require access to the internal data that DataTables has stored.

Type

function cell().cache( [ type ] )

Description:

Get cached data of the cache type specified

Parameters:
Returns:

DataTables API instance with the cached data for each selected cell in the result set

Example

Alert the :

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

$('#example tbody').on( 'click', 'td', function () {
	alert( table.cell( this ).cache( 'order' ) );
} );

Related

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