1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    20
    Vote Rating
    0
    venkateshwar is on a distinguished road

      0  

    Default Unanswered: How to get view variable in controller

    Unanswered: How to get view variable in controller


    How to get view variable in controller?
    and even if I update or change some properties in the variable, the view should update.
    How to do this?

    I tried:

    Code:
    var someVar = Ext.getCmp('idHere');
    //Selecting the third container from the collection of selected containers
    var someNestedChild = someVar.query('container')[2];      
    someNestedChild.el.dom.innerText = "I need to change this text";
    But the above is giving undefined error whenever I add el, dom or body to someNestedChild variable.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,641
    Vote Rating
    898
    Answers
    3573
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Why not use the update method on the someNestedChild component?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jan 2013
    Posts
    20
    Vote Rating
    0
    venkateshwar is on a distinguished road

      0  

    Default


    Hi,

    I am trying to avoid using ID's as much as I can. So, I just assigned ID to parent container. I know ID's are not suggested to use. I tried using ItemId's but everytime I am getting error 'undefined'.

  4. #4
    Sencha User
    Join Date
    Jun 2012
    Location
    India
    Posts
    50
    Vote Rating
    3
    Answers
    4
    girish.arjunagi is on a distinguished road

      1  

    Default


    You can have a refs of the required view inside the controller.
    Code:
    refs : [            {
                    ref : 'testView',
                    selector : '[xtype="testView"]'
                }]
    Get the view object with the getter getTestView() on controller object and query for the component with the itemId.