Categories | Question details Back To List | ||
dhtmlxTree and contextMenu question Hi, I use dhtmlxTree with contextMenu and works fine :-) But I have a question: Is posible to get a context menu checked option depending of userData value of the xTree node? Now I change a userData with the contextMenu but I want to view the selected userData in this menú. It's possible? Thanks for all Kind Regards Àlex Corretgé Answer posted by Support on Feb 15, 2008 05:28 You can attach custom code to onShow event of menu and update menu dynamically based on current node ( or its userdata ) aMenu.setOnShowMenuHandler(function(id){ //id of item for which menu will be opened aMenu.menu.getItem("some").setText(tree.getUsedData(id,"some")); }); Answer posted by Àlex Corretgé? on Feb 19, 2008 03:02 Is possible to set a img src? Now I have this function objAMenu.setOnShowMenuHandler(function(treeitemId){ if(opcio = punterTreeAssoc['objA'].getUserData(treeitemId,'simple_acl')) { objAMenu.menu.getItem(opcio).setText('* ' + opcio); } }); To reset the old setText actions I need to re-process all menu items? well I supose that I make a lot of work-arrounds to get the 'Selected item' menu functionality :-) Answer posted by Support on Feb 19, 2008 04:04 >>Is possible to set a img src? There is no API, but can be done as aMenu.menu.getItem("some").imageTag.src="new url"; >>well I supose that I make a lot of work-arrounds to get the 'Selected item' menu functionality :-) Actually to make menu specific for selected item - it is a too complex approach. http://dhtmlx.com/docs/products/dhtmlxGrid/samples/context_menu/pro_context_dynamic.html?un=1203423305000 You can create a set of necessary items in menu, and just use menu.showButtons menu.hideButtons to make it actual for currently selected item. |