Categories | Question details Back To List | ||
dhtmlXtree: problem with attaching to onClick, using URLS in user data, and auto-selecting an item in the tree. Background We want to use dhtmlXtree for the navigation to a web site. Initially we've been embedding the URL in the itemtext attribute, but since we don't want the findItem() function to search the URL, we're looking at storing the URL in a <userdata> section and per documentation I've seen, attach to the tree's onClick event & redirect to the clicked item's URL. The problem I'm running into is that, when a page is initially loaded, I need to auto-select the item in the tree that corresponds to the page in the tree. So, on page load, I have JS code that determines the item in the tree to select and then calls selectItem(). The problem that I'm running into is that selectItem() seems to cause the onClick event to fire. Since the code behind the onClick even now redirects to the items URL, I'm stuck in an endless loop in JS. Answer posted by Support on Jul 24, 2008 02:20 The second parameter of selectItem control execution of onclick event tree.selectItem(id,true); //select item and call onClick tree.selectItem(id,false); //select item, but not call onClick |