PDA

View Full Version : [SOLVED]Ext.onReady is firing twice



Elijah
25 Mar 2010, 5:16 AM
Okay, here is what I am doing.
Before you bash me saying why am I not using Ext's blah blah blah. The answer is that I am not aware of it. And in addition I am not given the time to learn how to properly use this. I am given just enough time to just get things working. So that being said, I have a main .js file.
I have a global array var MNS where I am registering modules to.
The .js modules that I am (or others are) writing I am trying to standardize so I can consitentently call them in a standard way.

Here is an example.
main.js


var MNS = new Array();

var DASHBOARD = function(argTitle, argModule){
this.entry = function(argTitle, argModule){
this.title = argTitle;
this.module = argModule;
} //

this.registerModule = function(argTitle, argModule){
MNS[MNS.length] = new this.entry(argTitle, argModule);
} //
} // DASHBOARD


module.js


Ext.onReady = function(){
var myMod = function(){...}

console.info('ext onready executed.');
DASHBOARD.register('myMod', myMod);
}


index.jsp


...
<script type="text/javascript" src="main.js"/>
...


The issue as I said is that the Ext.onReady is being called twice.

Condor
25 Mar 2010, 5:40 AM
You are using incorrect syntax.

Use:

Ext.onReady(function(){
var myMod = function(){...}

console.info('ext onready executed.');
DASHBOARD.register('myMod', myMod);
});

Elijah
25 Mar 2010, 5:49 AM
Thank you!
How do I mark this as resolved?

tryanDLS
25 Mar 2010, 6:13 AM
Just go to Thread Tools | Edit and change the title.