PDA

View Full Version : Ext JS 4.2.2 refs problem



vnggui
28 Nov 2013, 9:57 AM
Create refs in controller which is not referred in this.control:


refs: [
{
ref: 'settingsPage',
selector: '#extsettingspage'
},
{
ref: 'nextButton',
selector: '#nextbtn'
}
],

init: function(application) {
console.log('extSetup init ... ');
var me = this;

this.getApplication().on("MSG_SETUP", function(args,e) {
// login logic
console.log('controller.Setup: subscribe MSG_SETUP ');
me.appContainer = args.appContianer;
me.loginPanel = args.loginPanel;
me.mainPanel = args.mainPanel;
});

this.control({
nextButton:{ // replace nextButton to '#nextbtn' working, question: how to use refs' ref?
click:this.doNext
}
});
},
doNext: function() {
// is not triggered
}

xjscrafter
29 Nov 2013, 5:59 AM
I don't think this is possible the way you are trying to do it. In the init() control() method, you typically don't try to use references, because the components referred to might not fully exist yet.

You could use addListener() on the button, perhaps in an afterRender listener handler for its parent, but then its making things way too complex.

Just use itemId on the button and use #nextBtn. Seems in this case you don't need to use refs, do you?

evant
29 Nov 2013, 6:02 AM
Not possible in Ext at the moment (though it is in Touch).

We'll look at adding it in 5.x.