TypeError: TableTools is undefined.

TypeError: TableTools is undefined.

bigsipperbigsipper Posts: 31Questions: 2Answers: 0
edited March 2014 in TableTools
Why am I getting the message 'TypeError: TableTools is undefined.' when running the following code?

If I use the firefox debugger, I can put a break statement inside /TableTools-2.2.0/js/dataTables.tableTools.js and verify that IS being loaded. I can also see that TableTools is defined (to a function).

But, when it hits my document.ready() function it is undefined. What in the world could be undefining it?

I've installed all the latest packages into their own standalone directories at the root of my web tree - but I suspect this is having a side affect when dataTables and TableTools loads up.... Is there some kind of dependence on the installation tree/structure that is undocumented?

Please help....

-Bigsipper

[code]

<!DOCTYPE html>
<!--[if IE 8]> <![endif]-->
<!--[if gt IE 8]><!--> <!--<![endif]-->

















dragme



$(document).ready(function() {

$("#hoser").draggable();

var oTT = TableTools.fnGetInstance( 'expecttofail' );

}
);





[/code]

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    I don't see where you're initialising DataTables. TableTools is a DataTables plug-in.
  • bigsipperbigsipper Posts: 31Questions: 2Answers: 0
    See line 10 of code block. Is that not enough?
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    I'm guessing you mean line 11, where you link to datatables.js.
    I could be missing something here, but afaik you need to initialise a datatable in your docready function. Just linking to the js doesn't do it.
  • bigsipperbigsipper Posts: 31Questions: 2Answers: 0
    Added a table and init call... but getting same error:

    [code]
    <!DOCTYPE html>
    <!--[if IE 8]> <![endif]-->
    <!--[if gt IE 8]><!--> <!--<![endif]-->



















    Rendering engine
    Browser
    Platform(s)
    Engine version
    CSS grade




    Trident
    Internet
    Explorer 4.0
    Win 95+
    4
    X







    $(document).ready(function() {

    $('#todo').dataTable();

    var oTT = TableTools.fnGetInstance( 'todo' );

    }
    );





    [/code]
  • allanallan Posts: 63,488Questions: 1Answers: 10,467 Site admin
    I think actually this is a bug in TableTools 2.2.0. Can you try the 2.2.1-dev version from the nightly download please? http://datatables.net/download/build/dataTables.tableTools.nightly.js?_=60133663e907c73303e914416ea258d8 .

    Thanks,
    Allan
  • iain_mciain_mc Posts: 15Questions: 0Answers: 0
    Upgrading to the 2.2.1 dev version also fixed errors for me along the lines of...

    "TableTools: Warning - unknown button type: editor_edit"
    "TableTools: Warning - unknown button type: editor_create"

    After upgrading a previously working system to jQuery 1.11.0, Tabletools 2.0.0, Datatables 1.9.4 and Editor 1.2.4.

    Thanks Allan, will watch for the release version.
  • bigsipperbigsipper Posts: 31Questions: 2Answers: 0
    ah.... (this should really be hotpatched right away).

    I was able to get it to work by editing TableTools-2.2.0/js/dataTables.tableTools.js
    I removed line #443:
    442: /* Global scope for TableTools */
    443: var TableTools;

    I will try 2.2.1-dev and let you know.
  • bigsipperbigsipper Posts: 31Questions: 2Answers: 0
    Confirmed: Using dataTables.tableTools.nightly.js from 2.2.1-dev also solves the problem.
  • allanallan Posts: 63,488Questions: 1Answers: 10,467 Site admin
    Good to hear that helps. Yes, TableTools 2.2.1 is going to be released soon. It has one new feature as well, and I'm holding the release just incase there are any other minor changes coming from my work on Editor 1.3.

    Allan
This discussion has been closed.