marius
marius

Reputation: 1266

Mootools extension Behavior throwing error

since there is no guide to integrate this Mootools extension / plugin, I thought about including the scripts...

This should looks like this:

//standart
<script type="text/javascript" src="js/core/mootools.core.js"></script>
<script type="text/javascript" src="js/core/mootools.more.js"></script>

//addons        
<script type="text/javascript" src="js/behavior/Source/BehaviorAPI.js"></script>
<script type="text/javascript" src="js/behavior/Source/Behavior.js"></script>

//Here should be all the magic called...
<script type="text/javascript" src="js/main.js"></script>

But trying to call the website, it prints out into the console:

>>ReferenceError: Table is not defined
this._cleanupFunctions = new Table();<<

It seems that 'Table' is a Class writting in the extension 'More' but it seems not to exist...

Anyone having a solution for this?

Upvotes: 1

Views: 86

Answers (3)

Erin
Erin

Reputation: 5825

You may be calling it before Mooltools has loaded. Wait for the dom to load first:

window.addEvent('domready', function () {
    this._cleanupFunctions = new Table();
});

Upvotes: 2

Lorenz Meyer
Lorenz Meyer

Reputation: 19915

In fact it seems that Table does not exist as class. Are you sure if your more.js contains that class ? There are two points you have to check:

  1. This class only exists with mootools more 1.4. It did not exist before.
  2. When you download, you can create a custom build that only contains the classes you select and their dependencies. Probably your build does not include all classes. Redownload it and check Table to include it.

Upvotes: 2

Dimitar Christoff
Dimitar Christoff

Reputation: 26165

if you open your mootools-more.js file, it will have a url for the saved hash build. it will look like this:

http://mootools.net/more/09f3e47813269cd5026cbf8c1f828e72

visit the url (yours) then also add Table and any other deps you may have to and re-download, then replace your script.

Upvotes: 2

Related Questions