Categories | Question details Back To List | ||
Problem hidding an item in contextMenu inside a treegrid Hi team, I have a little problem when I use a contextMenu inside a treegrid. My code is as follows: var ctx = new dhtmlXMenuObject(null,"standard"); ctx.setImagePath("../../images/dhxmenu_standard/"); ctx.renderAsContextMenu(); ctx.setOpenMode("web"); ctx.attachEvent("onClick",onButtonClick); ctx.loadXML("../../ConsVarContextEXP"); mytreegrid.enableContextMenu(ctx); mytreegrid.attachEvent("onBeforeContextMenu",my_pre_func); function my_pre_func(rowId,celInd,grid){ var asis = mytreegrid.getUserData(rowId, "idwizard"); if (celInd!=0) { return false; } else { if (asis!=0) { ctx.hideItem("ctx5"); return true; } else return true; } } ----------------------------------------- If asis == 0 I want to show all items but if asis != 0 I want to show all items except ctx5. The problem is that if asis == 0 shows a empty page instead of contextMenu. I'm using version 2.0 PRO of your suite. Please, I need help!!! Thanks in advance. Answer posted by dhxSupport on May 11, 2009 05:29 Could you please provide sample where we can reproduce this issue? (Please send it directly to the support@dhtmlx.com) Answer posted by Fernando Siles on May 12, 2009 00:30 Hello, I'm working in a very big project with java and struts and javascript. It would be necessary all the files to reproduce error :( All the functions for contextMenu working perfect in my project except hideItem and showItem, do you have any problems registered with these functions? Thanks and sorry for my bad english. Answer posted by Alex (support) on May 12, 2009 01:49 Hello Fernando, hideItem method works. Please, check the sample in teh grid package dhtmlxGrid/samples/context_menu/pro_context_dynamic.html The possible reason for the problem is an incorrect xml for the menu - that why the menu can be empty. Please check that ConsVarContextEXP returns the correct xml. If issue isn't solve, please provide the example of the generated xml Answer posted on May 12, 2009 03:36 Hello again, I have included same js and css files than in the example and xml code that ConsVarContextEXP brings back is: <?xml version="1.0" encoding="ISO-8859-1"?> Same format than example. It's a really, really weird thing :( Thanks. Answer posted by Alex (support) on May 12, 2009 05:37 We've made a test. The same code and xml as you provided work correctly locally. Please, contact us at support@dhtmlx.com, provide your ref.number and we'll send you the test example. |