Hello!
I'm working on a project where the page in question has a javascript tree that has many expandable levels.
I want to add text field with a button and when the user enters a number and clicks "Find", javascript searches the tree for the value and automatically selects it.
As of now, I have the text field and I have a function that gives me the value of a particular node that I've selected manually in an alert. The problem is that I have no idea how to search the tree or automatically select a node if that search was successful.
Here's a bit of code so far (hope it helps):
Code:function findTreeNode(){ var fcInput = document.getElementById("fcInput").value; if(window.treeMyTreePrompt){ var tree = window.treeMyTreePrompt.getLastSelectedValue(); var treeVal = tree.getValue(); alert(treeVal); } }In this example, when I press FIND, an alert will appear giving me the string of the node I'm selecting.HTML Code:<input type="text" id="fcInput" value="" /> <input type="submit" value="Find" onclick="return findTreeNode()" />


Reply With Quote

Bookmarks