Categories | Question details Back To List | ||
context menu onclick function I have something like the following: menu=new dhtmlXMenuObject(); menu.renderAsContextMenu(); menu.loadXMLString('<menu width="100%" height="20" absolutePosition="auto" menuAlign="left" mode="popup" globalCss="contextMenu" globalSecondCss="contextMenu" globalTextCss="contextMenuItem" withoutImages="true"><item text="Add Header" height="25" width="25" id="add_header"/><item text="Add Footer" height="25" width="25" id="add_footer"/><item text="Restore Cell to Default" height="25" width="25" id="reset_cell"/><item text="Restore Row to Default" height="25" width="25" id="reset_row"/><item text="Delete Row" height="25" width="25" id="delete_row"/></menu>'); menu.attachEvent("onClick", function(id,zoneid){ alert("element "+id+" was clicked and zone "+zoneid+" was clicked"); }); The alert returns "element add_footer was clicked and zone false was clicked". It says that onclick passes both parameters only in case of a Contextual Menu which is what I declared mine as. Am I doing something wrong here? thanks in advance. Answer posted by Support on Oct 30, 2008 09:03 Right, zoneid is an id of context zone context zone: http://dhtmlx.com/docs/products/dhtmlxMenu/samples/init/context_zones.html?un=1225382786000 You didn't assing any context zones to menu so you have such result. Behaviour is correct. Answer posted by tiffany on Oct 30, 2008 10:16 After I build my grid, I have the following code:
grids.enableContextMenu(menu); menu.attachEvent("onClick", onMenuClick);
Still returns 'false' as second parameter, wonder why? Answer posted by Support on Oct 31, 2008 06:45 Problem confirmed. You can use grids.contextID inside event to receive necessary info, or contact us directly at support@dhtlmx.com , we will provide update which will restore sending ID as second parameter of onclick method. |