ExtJS 5: Using lookupReference in ViewController beforeInit -
i'm trying reference 1 of components in viewcontroller's beforeinit, can set variables on mycomponent before it's created, lookupreference not find component in beforeinit call... it's found in viewcontroller's init method, i'm assuming because view hasn't been rendered, reference hasn't been created.
so figured i'd try initcomponent, once again, lookupreference doesn't work in there... know create itemid , in initcomponent, that's last resort me... i'd rather use reference. see this fiddle example , code:
ext.application({ name: 'fiddle', launch: function() { ext.define('myviewcontroller', { extend: 'ext.app.viewcontroller', alias: 'controller.myview', beforeinit: function() { console.log('beforeinit: want exist before mycomponent rendered', this.lookupreference('mycomponent')); }, init: function() { console.log('init', this.lookupreference('mycomponent')); } }); ext.define('myview', { extend: 'ext.panel.panel', controller: 'myview', title: 'my view', height: 400, width: 400, items: [{ xtype: 'textfield', reference: 'mycomponent', fieldlabel: 'my component' }], initcomponent: function() { // want happen before mycomponent rendered console.log('initcomponent: want exist before mycomponent rendered', this.lookupreference('mycomponent')); this.callparent(); console.log('initcomponent callparent', this.lookupreference('mycomponent')); } }); ext.create('myview', { renderto: ext.getbody() }); } }); does have guidance on how accomplish this?
Comments
Post a Comment