Welcome Guest Search | Active Topics | Sign In | Register

Get treeview parent node through javascript Options
Ray Bradley
Posted: Wednesday, February 27, 2008 5:45:20 AM
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
eo_support
Posted: Wednesday, February 27, 2008 6:33:45 AM
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.html

Once 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.html

From parent group you can then get the parent item:

http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.NavigationItemGroup.getParentItem.html

So 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


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.