Categories | Question details Back To List | ||
[DHX MENU] add href/url to menu items Hello! I'm working with the 2.5 Menu and everything is working fine, except for the case that I can't add a href/url to a menu item; I have already read all the topics related to this matter but still no results. The method that I use for loading the menu is XML which has this form: <menu> <item text="Inicio" id="main_1"> <item text="Pagina de inicio" id="main_2"/> <userdata name="url">http://mywebsite/mypage</userdata> <item text="Dashboard" id="main_3"/> <userdata name="url">http://mywebsite/mypage</userdata> <item text="Usuarios" id="main_30"/> <userdata name="url">http://mywebsite/mypage</userdata> <item text="Contratos" id="main_1000"/> <userdata name="url">http://mywebsite/mypage</userdata> <item text="Repositorio" id="main_2000"/> <userdata name="url">http://mywebsite/mypage</userdata> </item> </menu> And the menu constructor is this: menu = new dhtmlXMenuObject("menuObj", "dhx_black"); menu.setIconsPath("pathtofiles/dhtmlxMenu/codebase/imgs/"); menu.attachEvent("onClick",function(id){ var url = menu.getUserData(id,"url") alert(menu.getUserData(id)); window.location.href=(url);}); menu.loadXML("mymenu.xml"); and the alert message says: null (in other words, the url in the userdata part of the xml is ignored), but the window location does not change. can you help me please? there's a way to put the url without the "http://www" part? and as a tip, in the product documentation you should put the info for all the forms of construction (for example, the mayority has the script based construction) because I wanted to know if the setHref property applies to the xml version and never find it. Thanks! Answer posted by Alex (support) on Dec 17, 2009 02:21 Hello, userdata tag should be set as a child node of an item tag: <menu> |