I want to check if a table element with say, id=\"datatable\" is datatables-initialized. Something like this:
if ($(\'#datatable\').dataTable().initialized) {
I have used callback()
function to do the same in my scenario. Thought of sharing this as an alternate approach
/* During Initialization */
var isTableInitialized = false;
$('#datatable').dataTable({/* your dataTable configurations*/},initializeDT());
/* Implement a callback function to set the value */
function initializeDT() {
isTableInitialized = true;
}
Later in code..
/* Checking for Initialization is easier*/
if(isTableInitialized) {
/* Do something here */
} else {
/* Do something here */
}