Results 1 to 3 of 3

Thread: Is it a way to set global variables for the application ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    41
    Answers
    2
    Vote Rating
    0
      0  

    Default Is it a way to set global variables for the application ?

    Hello,

    Is it possible to set globals before loading the first controller and view?
    For example i have a app.js which got :
    app.js :
    Code:
    Ext.application({    name: 'app',
    
    
        controllers: [
    		'Main',
    	],
    });
    and a
    controllers/Main.js :
    Code:
    Ext.define('IdeoSlideShow.controller.Main', {    extend: 'Ext.app.Controller',
    	
        views: [
    		'Home',
    	],
    ...
    The Home view and the Main controller are loaded before i can do anything in the init functions.
    Is it possible to set a global variable to configure the Home view?
    For example if i want to set the itemTpl of my Home view list with a global variable how can i do that ?


    regards

  2. #2
    Sencha User
    Join Date
    Sep 2011
    Posts
    125
    Answers
    1
    Vote Rating
    0
      0  

    Default

    Global variables are a bad idea. What exactly are you trying to achieve? Seems like it would be more appropriate to create a store and model for hosting what seems to be configuration values.

  3. #3
    Sencha User rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,159
    Answers
    93
    Vote Rating
    7
      0  

    Default

    Perhaps in your controller you could use the appropriate setters on your view?

    Code:
    init: function() {
        this.getHome().setItemTpl('adsasd');
    }
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •