Can initComplete be 'listened' from one instance of datatable object?
Can initComplete be 'listened' from one instance of datatable object?
![teojicd](https://secure.gravatar.com/avatar/e28068c4105c0ad5853d346e63b7776c/?default=https%3A%2F%2Fvanillicon.com%2Fe28068c4105c0ad5853d346e63b7776c_200.png&rating=g&size=120)
I understand that if we have already initialized a datatable on one HTML table element, then we can access the instance of that object with the following line of code:
var table = $("#searchProdTable").DataTable();
Normally initComplete is used in this manner:
$('#example').dataTable( {
"initComplete": function(settings, json) {
alert( 'DataTables has finished its initialisation.' );
}
} );
What I want to know if it is possible to 'listen' to the initComplete event of an already initialized datatable. I was thinking if such a syntax is possible:
var table = $("#searchProdTable").DataTable();
table.initComplete (){
console.log("table has finished initialization");
}
Or that is not possible at all. Whatever initComplete callback handler you want, you have to write it straight away when creating the datatable.
Thanks!
Answers
Hi @teojicd ,
You can use
init
, this is likely to do what you want. See the example on the bottom of that page,Cheers,
Colin