fnGetInstance not working in 2.2.0

fnGetInstance not working in 2.2.0

RC7502RC7502 Posts: 2Questions: 0Answers: 0
edited February 2014 in TableTools
I just upgraded to TableTools 2.2.0 and haven't changed any of my other code. However, I now get an error when trying to run the following line:

var oTableTools = TableTools.fnGetInstance('tablename');

The error is:

TypeError: TableTools is undefined

I know TableTools is being referenced correctly because the export buttons work fine on other pages. Unfortunately this is an internal website so I can't post a link. What would have changed going from 2.1.5 to 2.2.0 and how do I fix it?
Thanks

Replies

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin
    Try the 2.2.1-dev version from http://datatables.net/download . I think the problem is that I defined `var TableTools` twice...

    Worth also pointing out that the global variable will be dropped in the next major version of TableTools, with `$.fn.dataTable.TableTool` being used - to match the style of all the other extensions.

    Allan
  • RC7502RC7502 Posts: 2Questions: 0Answers: 0
    Going to 2.2.1 fixed it for me. What is the syntax going to be using $.fn.dataTable.TableTool in the future versions?
    Thanks!
  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin
    $.fn.dataTable.TableTool will have the same syntax as before, it just isn't polluting the global namespace.

    Allan
This discussion has been closed.