Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

Hybrid View

  1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    91
    Answers
    6
    Vote Rating
    0
    alex9311 is on a distinguished road

      0  

    Default Unanswered: Variables accessible from all controller functions? (MVC)

    Unanswered: Variables accessible from all controller functions? (MVC)


    Hey all,

    I'm using the MVC application structure. I've got a controller with quite a few functions in it. They all access a lot of the same components in my application but I think I've written it very inefficiently.

    For example, I have several buttons that affect the grid in my application. In each button function I have to do something like
    Code:
    var panel = button.up(panel);
    var grid = panel.down(grid);
    Instead of having those two lines in each button function, is there somewhere in the controller where I can define panel and grid (and the other components in my application) so they can be accessed by all my controller functions?

    thank you!

  2. #2
    crysfel's Avatar
    Join Date
    Feb 2008
    Location
    New York, USA
    Posts
    215
    Answers
    7
    Vote Rating
    8
    crysfel will become famous soon enough

      1  

    Default


    You can try the references:

    Code:
    Ext.define('YourApp.controller.Main',{
        extend : 'Ext.app.Controller',
    
        refs : [
            {ref:'grid',selector:'acontainer anotherpanel grid[itemId=yourId]'}
        ],
    
        aFunction : function(){
            this.getGrid().getStore().load();
        }
    });
    First you define a reference with a selector, then you can access that reference by a dynamic method called "getYourReferenceName".

    These references are accesible only by the current controller.

    Regards

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    91
    Answers
    6
    Vote Rating
    0
    alex9311 is on a distinguished road

      0  

    Default


    Thank you, I've done some more reading about references now.

    So you can refer to specific instances of views in your app right? And once defined, calling a reference should be faster than doing a component query?

Thread Participants: 1

Tags for this Thread