View Full Version : Passing value to app.js from HTML element at application initiation

7 Oct 2012, 9:24 PM
Hi All,

I am wondering whether we could pass value to app.js from onReady method. I need to pass a value so that the initial application view would vary for each value. It would be helpful and save me lot of work arounds. If anyone have idea about this, I would be glad to see it.

Premkumar. A

10 Oct 2012, 9:28 AM
pass a variable how? Like in the URL?

10 Oct 2012, 8:33 PM
Here is my situation. I have an application which needs its primary setting (an integer value) from html page. In 'index.html', I get the input and at the next page, I have included the app.js. According to the given input, the number of columns are created in a panel. So I need to take the value to app.js in what ever way it is possible. Now I am using the DOM search and getCmp to get the value at app.js. Is there any other way to do this?

10 Oct 2012, 9:02 PM
The easiest way would be to have an script-block at your HTML-Page which provides this variable as a global.

var myConfVar = 42;
<.... ext_4_1_1/ressources/ext-all.js ...>
<.... app.js ...>

So your app.js could use the global var. You could even a global config-object which contains more than one variable.