drawCallback parameter properties/functions dovcumentation
drawCallback parameter properties/functions dovcumentation
mp108
Posts: 3Questions: 2Answers: 0
Is there documentation listing the available properties and functions for the parameter passed to the drawCallback function?
The datatable option is defined as:
"drawCallback": function( settings ) {
What functions or properties are available for the parameter 'settings'?
For example, I would like to get the id of the dataTable div; currently I do it by:
'drawCallback': function( settings ) {
// call callback function on every dataTable redraw
if(config.fnDrawCallback){
config.fnDrawCallback(this.api());
}
}
Function in config called:
function drawCallback(api){
var tableId = api.context[0].sTableId; // there must be a simpler/better way to do this??
This discussion has been closed.
Answers
https://datatables.net/reference/type/DataTables.Settings
table().node()
would be the way to get the table id - e.g.:Don't use the settings object for anything other than creating an API instance (if you even need to do that, which you don't in this case, use
this.api()
as you have done).Allan