PDA

View Full Version : Contextmenu not closing after building with sencha cmd



damianob
17 Sep 2014, 4:35 PM
Hi-
I'm working on an app that is using version 4.2.1.883. I have a simple context menu that works under my dev folder, but when I build with sencha cmd, it changes behavior. The context menu does not close after clicking outside of the menu after building. This also applies to the loading message after loading a grid store.

The menu code looks like this:


Ext.define('wims.view.component.TreeContextMenu', {
alias: 'widget.componentcontextmenu',
extend: 'Ext.menu.Menu',

initComponent: function() {
this.callParent(arguments);
},


items: [
{
text: 'Add New Component',
handler: function (node, menu) {
if (node.internalId) {
eventBus.fireEvent('component.create.init', node.internalId);
}
}
},
{
text: 'Edit',
handler: function (node, menu) {
if (node.internalId) {
console.log("Editing Component");
eventBus.fireEvent('component.edit.init', node.internalId);
}
}
},
{
text: 'Remove Component',
handler: function (node, menu) {
if (node.internalId) {
eventBus.fireEvent('component.destroy', node.internalId);
}
}
},
'-',
{
text: 'Refresh',
//
handler: function (node, menu) {
if (node.internalId) {
if (node.data.id == "root") {
eventBus.fireEvent('component.load', 1);
} else {
var internalId = node.internalId.split("_"); //splits "component_{id}" into an array ["component",id]
if (internalId[0] == "component") {
console.log("refreshing: " + internalId[1]);
eventBus.fireEvent('component.reload', internalId[1]);
}
}
}
}
}
],
listeners: {
click: function (menu, item, e, eOpts) {
//console.log("clicked context menu: " + this.node.internalId);
item.handler(this.node, menu);
}
}
});


Again, this does it for the loading animation on the grid. I've tried setting animCollapse to false, and I also tried requiring Ext.fx.*, but that didn't help. Everything works fine in the working version, but as soon as I build, the menus open, but do not close.

I am using this for opening my menu:


itemcontextmenu: function(view, rec, node, index, event){ var menu = new wims.view.component.TreeContextMenu();
event.stopEvent();
menu.activeFeed = view.store.getAt(index);
menu.node=rec;
menu.showAt(event.getXY());
}


I've spent most of a day trying to figure this out, but I'm having trouble debugging once I build. I want to see if the following line is skipped, or if it runs and does nothing:

dom.style.visibility = visible ? '' : HIDDEN;

(From ext-dev.js setVisible function)

Thanks for any info/help,
Damian

damianob
17 Sep 2014, 4:40 PM
I just found a fix from this thread:http://www.sencha.com/forum/showthread.php?287090-ext-4.2.1.883-cmd-5.0.0.160-Layer-doesn-t-hide-properly-for-packaged-appsIt tested it and it works!