Check if DOM table is DataTable instance
Check if DOM table is DataTable instance
Hi,
Is there a way to determine if a "" is an instance of DataTable ?
Please consider the code below, where the "a.delete_button" is inside a part of a simple table, or a dataTable:
[code]
("a.delete_button").click(function() {
var $tr = $(this).closest('tr');
var $table = $(this).closest('tr').parents('table');
//Execute the fnDeleteRow() only if $table is a dataTable
$table.dataTable().fnDeleteRow($tr);
});
[/code]
Thanks.
Olivier
Is there a way to determine if a "" is an instance of DataTable ?
Please consider the code below, where the "a.delete_button" is inside a part of a simple table, or a dataTable:
[code]
("a.delete_button").click(function() {
var $tr = $(this).closest('tr');
var $table = $(this).closest('tr').parents('table');
//Execute the fnDeleteRow() only if $table is a dataTable
$table.dataTable().fnDeleteRow($tr);
});
[/code]
Thanks.
Olivier
This discussion has been closed.
Replies
Allan
Thank you for your quick answer Allan.
Allan
Thanks !