keckeroo
29 Nov 2011, 10:57 AM
I have a card panel which is created in a Main view for the viewport. Tied to that panel I have a controller looking for events on the card panel.
In the Main view ... during the init ..
init: function() {
this.getMain();
if (authenticated) {
this.getMain().setActiveItem(1);
}
}
Controller:
this.control({
'panel1': {
activate: function() { alert("I'm active"); }
}
});
Now - when the application boots and I am not authenticated - card 0 is displayed for the login panel, I log in - card 1 is set active and perfect - the controller sees panel1 as active and fires the alert.
If, however, I reload the app and (because of cookies, etc) I am already authenticated the Main view does the 'setActiveItem' above - but the controller does not see the 'activate' event.
I have attached a listener directly to the panel, listening for 'activate' and both scenarios (non authenticated and preauthenticated) trigger the activate method. It's just when I try to do it using the controller that it's not noticed.
Of course, I would prefer to use a controller - since - um - that's where I should be listening for all these events - not in the panel itself.
Bug ?
Thank you.
Kevin
In the Main view ... during the init ..
init: function() {
this.getMain();
if (authenticated) {
this.getMain().setActiveItem(1);
}
}
Controller:
this.control({
'panel1': {
activate: function() { alert("I'm active"); }
}
});
Now - when the application boots and I am not authenticated - card 0 is displayed for the login panel, I log in - card 1 is set active and perfect - the controller sees panel1 as active and fires the alert.
If, however, I reload the app and (because of cookies, etc) I am already authenticated the Main view does the 'setActiveItem' above - but the controller does not see the 'activate' event.
I have attached a listener directly to the panel, listening for 'activate' and both scenarios (non authenticated and preauthenticated) trigger the activate method. It's just when I try to do it using the controller that it's not noticed.
Of course, I would prefer to use a controller - since - um - that's where I should be listening for all these events - not in the panel itself.
Bug ?
Thank you.
Kevin