estesbubba
27 Dec 2011, 1:34 PM
Two of us have to trying to figure this out and it seems like it should be simple. We have controllerA that has a custom event 'showDevelopmentMenu' and does a fireEvent on it. Here is a simplified view of what we're doing.
Ext.define('Csg.controller.A', {
extend: 'Ext.app.Controller',
config: {
bubbleEvents: [
'showDevelopmentMenu'
]
},
init: function() {
var me = this;
me.control({
'main #actionsButton': {
tap: me.onActionsButtonTap
}
});
},
onActionsButtonTap: function() {
var me = this;
me.fireEvent('showDevelopmentMenu');
}
});
Ext.define('Csg.controller.B', {
extend: 'Ext.app.Controller',
init: function() {
var me = this;
me.control({
showDevelopmentMenu: me.showDevelopmentMenu
// '*': {
// showDevelopmentMenu: me.showDevelopmentMenu
// }
});
},
showDevelopmentMenu: function() {
debugger;
}
});
I know the simple would would be have controllerB do a this.control() on the button but we have reasons for not doing that. Since controllerA creates the view that has the button we want it to fire a custom event that controllerB is listening for. We can see controllerA firing the event but controllerB doesn't get it. We've tried all kinds of things with this.control().
Any suggestions?
Ext.define('Csg.controller.A', {
extend: 'Ext.app.Controller',
config: {
bubbleEvents: [
'showDevelopmentMenu'
]
},
init: function() {
var me = this;
me.control({
'main #actionsButton': {
tap: me.onActionsButtonTap
}
});
},
onActionsButtonTap: function() {
var me = this;
me.fireEvent('showDevelopmentMenu');
}
});
Ext.define('Csg.controller.B', {
extend: 'Ext.app.Controller',
init: function() {
var me = this;
me.control({
showDevelopmentMenu: me.showDevelopmentMenu
// '*': {
// showDevelopmentMenu: me.showDevelopmentMenu
// }
});
},
showDevelopmentMenu: function() {
debugger;
}
});
I know the simple would would be have controllerB do a this.control() on the button but we have reasons for not doing that. Since controllerA creates the view that has the button we want it to fire a custom event that controllerB is listening for. We can see controllerA firing the event but controllerB doesn't get it. We've tried all kinds of things with this.control().
Any suggestions?