As far as I understand, you want to use the "Event Bus" template? You can use the global and only object that exists in every ST2 application - Ext.Viewport. At least I create in my application, and so far nothing is bad. Note. The best place to create an event handler is the controller's init () method.
Ext.define('Myapp.controller.ActivitiesController', {
extend : 'Ext.app.Controller',
requires : [],
config: {
refs: {
myview: 'myview'
}
...
init: function () {
var me = this;
Ext.Viewport.on({
scope: this,
addactivitytype: function (config) {
var myview = me.getMyview(),
record = config.record
...
});
}
});
in another controller (or ever) you can write
addActivityTypeTap: function (record) {
....
Ext.Viewport.fireEvent('addactivitytype', {
record: record
});
}
source
share