PDA

View Full Version : View getters in Controller : strange behavior



YomeKitsuma
28 Feb 2012, 2:27 AM
Hi,

In a controller, with 'views' setted, i've got a strange behavior while trying to work with the getters of views.


doSelect : function(model, record) {
var me = this,
infoView = me.getStockInfoView();

console.log('> doSelect : ' + Ext.getClassName(infoView));

infoView.getComponent('stock_info_name').update(record.get('Name'));

}
The class name is ok, it's give me the right class name > doSelect : Foo.view.stock.Info)

But when i try to 'getComponent' I've got this error :

Uncaught TypeError: Object function () { return this.constructor.apply(this, arguments); } has no method 'getComponent'

I wonder what i'am doing wrong there ? :-?

N.b : does the 'getMyPanelView()' returns a Class or an Instance - this is maybe why... ?!

YomeKitsuma
28 Feb 2012, 2:43 AM
...I'am right, those 'view' getters return a 'Class', not an instance.

So, i've still also have a problem concerning the 'views' in a controller :

I've define a 'ref' to point on my view.
I've try to get a 'component' using the 'getComponent' method (with the good id).



var me = this,
infoView = me.getStockInfo(); //defined in the refs

infoView.getComponent('stock_info_name').update(record.get('Name'));


returns this error :


Uncaught TypeError: Cannot call method 'update' of undefined


But doing this :



var me = this,
infoView = me.getStockInfo();

Ext.getCmp('stock_info_name').update(record.get('Name'));


all works fine !

ps : the 'container' (stock_info_name) is nested in one container and one panel in the stock view.