Rank: Member Groups: Member
Joined: 10/31/2007 Posts: 18
|
I'm working with asp.net and I have a eo treeview on my page... I use the following javascript to identify the node, or selected item... but I need to get its parent node text... I haven't been able to figure this out... racking my brain. Please help:
function treeview_itemclick_handler(e, eventInfo) { var thisLocationID = document.getElementById("txtLocationID") var thisCustno = document.getElementById("txtCustno")
thisLocationID.value = eventInfo.getItem().getText() -> thisCustno.value= ????????????? s/b something like: eventInfo.getParent().getText() <-
}
nodes work like this: Custno-LocationID... the "eventInfo.getItem().getText() " seems to identify the selected node... but how do I get its (the location's) parent text (custno)
-rb
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi, eventInfo.getItem() returns a client side TreeNode object: http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.TreeNode.htmlOnce you have the TreeNode object, you can call this function to get its parent group: http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.NavigationItem.getParentGroup.htmlFrom parent group you can then get the parent item: http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.NavigationItemGroup.getParentItem.htmlSo the final code would be eventInfo.getItem().getParentGroup().getParentItem(). Except for the two step process, the other tricky part is TreeNode derives from NavigationItem. So you can use all the methods that are available on NavigationItem. Thanks
|