Welcome Guest Search | Active Topics | Sign In | Register

TreeView Options
Amiran
Posted: Wednesday, November 26, 2008 7:41:08 AM
Rank: Member
Groups: Member

Joined: 11/21/2008
Posts: 15
Hello,

Please help me. I’m trying to select a TreeNode in code. I know the path to the treenode, for example node1/node2/item1 and I know the ID (item1) how can I make sure the treeview is expanded so that item1 is visible and how can I select item1 ?

Best regards,
Amiran
eo_support
Posted: Wednesday, November 26, 2008 8:22:48 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,097
Hi,

You can do it either on the server side or client side. On the server side you can do something like this:

Code: C#
EO.Web.TreeNode node = (EO.Web.TreeNode)TreeView1.FindItem(path);
if (node != null)
{
    node.Selected = true;
    node.EnsureVisible();
}


On the client side you can do something like this:

Code: JavaScript
var treeView = eo_GetObject("TreeView1");
var node = treeView.findItem(path);
if (node != null)
{
    treeView.setSelectedNode(node);
    node.ensureVisible();    
}


Hope this helps.

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.