Can't be able to find datatable using .isDataTable in ui tabs with same table ID
Can't be able to find datatable using .isDataTable in ui tabs with same table ID
Hi, I have ,
$(document).on("click", "#" + newCurrentWidgetId + "#add-line-items", function () {
NewCurrentWidgetId = getCurrentWidgetId();
if ($.fn.DataTable.isDataTable('#' + NewCurrentWidgetId + ' #item-info-table')) {
alert("Present");
}
});
This is the case when i append tabs. when i append tabs above script gets loaded in which we have "newCurrentWidgetId " as id of that tab. We can open multiple tabs and "newCurrentWidgetId " changes everytime. Inside that "NewCurrentWidgetId " is returning current opened tab's id which is working well.
And at last with every tab append i am also initiating the datatable with it's click function (code above). Now when more then one tab is appended simultaneously the above alert works fine in case of latest tab only. when i switch the tab it cannot find the datatable so no alert is coming. Don't know why. Every variable is changing fine.
Need Quick help.
Thanks in advance.