View Full Version : How to get view variable in controller

19 Mar 2013, 3:45 AM
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:

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.

21 Mar 2013, 6:32 AM
Why not use the update method on the someNestedChild component?

21 Mar 2013, 8:00 PM

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'.

21 Mar 2013, 10:18 PM
You can have a refs of the required view inside the controller.

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.