Easiest way to get oTableTools object after initialization?

Easiest way to get oTableTools object after initialization?

rgvcorleyrgvcorley Posts: 29Questions: 0Answers: 0
edited June 2012 in TableTools
I am initializing TableTools like so:-

[code]
var oTableTools = new TableTools(oTable,{settings});
[/code]

I would like to later on use the API methods of TableTools. I've tried saving the oTableTools object as a property in the DataTable object like so:-

[code]
oTable.oTableTools = oTableTools;
[/code]

But this doesn't seem to work. Maybe the easiest method would be to use jQuery's data(); method and simply save it on the DOM object.

Replies

  • allanallan Posts: 63,680Questions: 1Answers: 10,498 Site admin
    $.data() is certainly one option, but the one I tend to use is TableTools' static fnGetInstance method: http://datatables.net/extras/tabletools/api#fnGetInstance . Just pass in the ID of your table as a string and it will give you the TableTools instance.

    Allan
  • rgvcorleyrgvcorley Posts: 29Questions: 0Answers: 0
    Once again I should have studied the API docs more closely! Many thanks!
This discussion has been closed.