on 06-17-2008 1:06 PM
I am building a tree that displays a company's workarea heirarchy in the wdDoInit method of a view. I would like the tree to be displayed fully expanded.
I tried setting the expand = "true" attribute of the TreeNode, but to no avail, the tree still shows fully collapsed. Any ideas?
Say you have the following context structure:
TreeNodes (node, 0:n)
-- expanded (boolean)
-- Children (recursive node -> TreeNodes)
and you have bound the "expanded" property of the TreeNodeType element to context attribute "TreeNodes.expanded".
To expand all tree nodes, recursively set the "expanded" attribute value to true:
void expandAll(ITreeNodesElement treeNode)
{
treeNode.setExpanded(true);
for (int i = 0; i < treeNode.nodeChildren().size(); ++i)
{
ITreeNodesElement child = treeNode.nodeChildren().getTreeNodesElementAt(i);
expandAll(child);
}
}
wdDoInit()
{
/* assume we have at most one root */
if (wdContext.nodeTreeNodes().size() > 0)
{
expandAll( wdContext.nodeTreeNodes().getTreeNodesElementt(0) );
}
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try
Creating a context attribute of type boolean as part of the node which is bound to the tree by nesting table and set this attribute to true.
And bind this to the expanded property of tree by nesting UI element.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.