cell().render()
Get rendered data for a cell.
Description
DataTables has the ability to use orthogonal data - i.e. different data for the same cell, depending on the operation being performed. A typical example of this is date / time data being used in numeric format (i.e. a timestamp) for sorting, but a complex formatted form for display.
The cell().data()
method provides access to the underlying raw data, while this method provides access to the rendered data for each type. It is provided to allow plug-in authors access to the orthogonal data available in the table.
Note that calling this method will evaluate the renderer for the cell, rather than reading the information from cache (see cell().cache()
to read from cache and cell().invalidate()
to clear cache).
Type
function cell().render( type )
- Description:
Get rendered data for the selected cell
- Parameters:
Name Type Optional 1 type
No Data type to get. This can be one of:
display
filter
or (since 1.11)search
sort
or (since 1.11)order
type
- Returns:
Any
Rendered data for the requested type
Examples
Get the display information for the cell clicked on:
var table = new DataTable('#myTable');
$('#example').on('click', 'tbody td', function () {
var data = table.cell(this).render('display');
console.log(data);
});
Get the order information for the cell clicked on:
var table = new DataTable('#myTable');
$('#example').on('click', 'tbody td', function () {
var data = table.cell(this).render('sort');
console.log(data);
});
Related
The following options are directly related and may also be useful in your application development.