extjs4 - extjs 4 how to declare a global variable from a store -


we have extjs4 - spring mvc application. declare variable user information (name, firstname, role). role can set field in read or hidde part of application.

in app.js:

ext.application({    name: 'appname',    appfolder: 'js/app',    enablequicktips:true,    controllers: [               'maincontroller',....                ],    autocreateviewport: true,    globals:       var1 : 5    //it works simple variable  }); 

i create store variable this

var appglobalstore = ext.getstore('mystore'); 

this not possible :

globals:      appglobalstore : ext.getstore('mystore'); 

and value in extjs (i guess)

var role= appname.app.globals.role 

is possible ? or if it's not possible, whereever need role have declare ? that

var role = ext.getstore('mystore').getat(0).raw.role; 

the name given app name of global variable extjs provides you.

so, can that:

appname.role = role = ext.getstore('mystore').getat(0).raw.role; 

then can access role by:

var x = appname.role; 

and can assign value "appname.role" in launch attribute of application:

ext.application({    name: 'appname',    appfolder: '/extjs-app/app',    controllers: [       'maincontroller', ..    ],    requires: [       'appname.utils.logger', ...    ],    autocreateviewport: true,    launch: function() {       appname.role = role = ext.getstore('mystore').getat(0).raw.role;    } }); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -