How to get dataTable object after init?
How to get dataTable object after init?
The suggested way to use dataTables is:
[code]oTable = $('#tDataTable').dataTable(...);[/code]
Then I can do whatever I want with oTable object.
But I want to work another way:
[code]$('#tDataTable').dataTable(...);//init
...
oTable = $('#tDataTable').dataTable();//wanted action - get dataTable object.
oTable.fnUpdate(...);
[/code]
How can I make it come true?:)
[code]oTable = $('#tDataTable').dataTable(...);[/code]
Then I can do whatever I want with oTable object.
But I want to work another way:
[code]$('#tDataTable').dataTable(...);//init
...
oTable = $('#tDataTable').dataTable();//wanted action - get dataTable object.
oTable.fnUpdate(...);
[/code]
How can I make it come true?:)
This discussion has been closed.
Replies
...
//---
$(".datatable").each(function () {
var oTbl = $(this).dataTable();
$(this).data('datatable', oTbl);
});
//---
// Then you can retrieve it from the table element
var oTbl = $("#myTable").data('datatable');
Allan