PDA

View Full Version : Contextmenu's in 3.0



pcrombach
22 Apr 2009, 10:17 AM
Another weird problem is contextmenu's in Extjs 3.0.
I load contextmenu's dynamically from server. Sometimes there are more options in the menu than I expected. I inspected the loaded JSON in firebug for these menu's but they are allright. the number of menu entries seems to be random. One 1 entry loaded form service (as JSON) display 5 or sometimes even 8 entries show in the menu.

In Extjs 2.2.1 everything works perfect.

pcrombach
22 Apr 2009, 10:26 AM
Here is the piece of code I use to populate the menu's:



extEl.on('dblclick', function(e, t){
e.stopEvent();
//
// Shortcut dblclick start
// Haal met Ajax het contextmenu op voor deze user deze module
//
Ext.Ajax.request({
scope: this,
url: 'fmisondemand/Hoofdmenu/SubMenuConfig.php',
params: {module: module},
method: 'POST',
success: function(response, options){
var decoded = Ext.decode(response.responseText);
var menuitems = decoded.menu;
if(decoded.success){
menu = new Ext.menu.Menu({
id: 'desktopcontextMenu',
items: menuitems
});
menu.showAt(e.getXY());
}
}
});
});

pcrombach
22 Apr 2009, 10:54 AM
I'm proud on myself. I fixed this problem. All generated menu's did have the same Id. After make them unique all is fine again. Again a nice lesson to make all Id's unique. Even in a very large application.

mjlecomte
22 Apr 2009, 8:29 PM
This would have been a problem in any version of Ext, including Ext 2.2.1.