How to get datatable object when using multiple datatables?
How to get datatable object when using multiple datatables?
I have multiple datatables on my page and I have onclick events on every row. Is there any clean way how to get appropriate datatable object of the currently clicked table?
[code]
$(document).on("click", ".datatable tbody tr", function(e) {
var table = [get oTable object of the clicked table]
...
})
[/code]
UPDATE: Ok http://datatables.net/forums/discussion/comment/12531
[code]
$(document).on("click", ".datatable tbody tr", function(e) {
var table = [get oTable object of the clicked table]
...
})
[/code]
UPDATE: Ok http://datatables.net/forums/discussion/comment/12531
This discussion has been closed.
Replies
var table = $(this).parents('table').dataTable();
[/code]
will do the business. The `dataTable()` "constructor" will return the already created instance if the table has already been DataTables-ised"...
Allan