Results 1 to 4 of 4

Thread: How to get view variable in controller

  1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    20
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    Why not use the update method on the someNestedChild component?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Jan 2013
    Posts
    20
    Vote Rating
    0
      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
    Answers
    4
    Vote Rating
    3
      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.

Tags for this Thread

Posting Permissions

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