column().cache()
Get the DataTables cached data for the selected column.
Deprecated!
As of v2.0 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.
Use column().render()
to get the data for a specific rendering type, rather than accessing DataTables' cache. This method will be removed in DataTables 3.
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, for example when creating a select
list to provide a column based filter.
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.
Please note that the order of the data in the returned array and which rows the data is obtained from (searched rows, visible rows etc) is controlled by the selector-modifier
option of the column()
selector used to get the selected column.
Additionally, if the selector used in column()
matches more than one column, the result set will be truncated to a single column - the first one in the result set.
Type
function column().cache( [ type ] )
- Description:
Obtain the data for the column from the selector
- Parameters:
Name Type Optional 1 type
Yes - default:order Specify which cache the data should be read from. Can take one of two values:
search
ororder
. Defaults toorder
if no value is given.- Returns:
DataTables API instance with data for each cell in the selected column in the result set. This is a 1D array with each entry being the data for the cells from the selected column.
Related
The following options are directly related and may also be useful in your application development.