View Full Version : custom menu items

22 Feb 2010, 5:54 AM
hi there, i'm trying to make a server side structure to be used as a client side menu item

server side

public struct ContextMenuItem
public string text;
public string handler;

client side

var itemmenu_custom = new Ext.menu.Menu();
if (record.get('contextmenu') != null)
for(var ctr = 0; ctr < record.get('contextmenu').length; ctr++)
itemmenu_custom.add({text:record.get('contextmenu')[ctr].text, handler:new Function(record.get('contextmenu')[ctr].handler)});

the menu is showing up but the handler is not firing, what am i missing, and also how can i add multiple handlers per menu item?

22 Feb 2010, 6:01 AM
got the answer from this one


used this code instead

itemmenu_custom.add({text:record.get('contextmenu')[ctr].text, handler:eval("record.get('contextmenu')[ctr].handler = "+ record.get('contextmenu')[ctr].handler)});

but how can i add multiple event listener from the server side since this is only adding the click event handler?