retrieve
Retrieve an existing DataTables instance.
Description
Retrieve the DataTables object for the given selector. Note that if the table has already been initialised, this parameter will cause DataTables to simply return the object that has already been set up - it will not take account of any changes you might have made to the initialisation object passed to DataTables (setting this parameter to true is an acknowledgement that you understand this!).
The destroy
option can be used to reinitialise a table with different options if required.
Type
This option can be given in the following type(s):
Default
- Value:
false
Example
Retrieve DataTable instance for an existing table:
$(document).ready(function () {
initTable();
tableActions();
});
function initTable() {
return new DataTable('#myTable', {
scrollY: '200px',
paginate: false,
retrieve: true
});
}
function tableActions() {
var table = initTable();
// perform API operations with `table`
// ...
}
Related
The following options are directly related and may also be useful in your application development.