Cine
5 Jan 2012, 2:58 AM
I am having some problems with figuring out how to populate a menu in the controller.
In my view, in initComponent, I create the menu like this:
me.items = [new Ext.menu.Menu({
id: 'myMenu',
items: []
})];
and then in the controller I would like to be able to do something like:
init: function () {
var me = this;
me.control({
'#myMenu': { created: me.createMenuStructure }
});
me.callParent();
},
createMenuStructure: function () {
debugger;
var menu = [];
menu.push(Ext.create('blablabla', { app: this.application }));
this.items = menu;
}
I have confirmed that
Ext.ComponentQuery.query("#myMenu") returns the object, so that part should work. However, I have tried a ton of different event names, and nothing is working for me "created, added, beforeadd, enable". Debugger never breaks.
It is probably something trivial since I am still learning Ext, but I cant see it.
In my view, in initComponent, I create the menu like this:
me.items = [new Ext.menu.Menu({
id: 'myMenu',
items: []
})];
and then in the controller I would like to be able to do something like:
init: function () {
var me = this;
me.control({
'#myMenu': { created: me.createMenuStructure }
});
me.callParent();
},
createMenuStructure: function () {
debugger;
var menu = [];
menu.push(Ext.create('blablabla', { app: this.application }));
this.items = menu;
}
I have confirmed that
Ext.ComponentQuery.query("#myMenu") returns the object, so that part should work. However, I have tried a ton of different event names, and nothing is working for me "created, added, beforeadd, enable". Debugger never breaks.
It is probably something trivial since I am still learning Ext, but I cant see it.