Salesforce

How Do I Automatically Open the Tree with All Its Nodes or only Several Nodes Expanded? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Automatically Open the Tree with All Its Nodes or only Several Nodes Expanded? (Magic xpa 3.x)

Auto Expand = False

Auto Expand is set to an expression which
opens the root and one node

By default, when a tree opens, none of the nodes are expanded. This is shown in the example on the left. The user can double click on a node, or press the ‘+’ button, to expand the tree as needed.

However, you can selectively expand the tree when it opens. This is done using the Auto expand control property.

If Auto expand is set to True, all the nodes will expand. However, it can also be set to an expression to selectively expand nodes. The example on the right expands two nodes: ‘ROOT’ and ‘S004’.

This feature can be used with TreeNodeGoto() to open the tree and position the cursor for the user.

Setting Auto expand to a specific node

  1. Select the Tree control.

  2. Set Control Properties -> Auto expand to True. This will expand all the nodes when the tree opens.

    Alternatively, you can use an expression to selectively expand nodes. In this example, we expand the node when the node ID is ‘ROOT’ or ‘S004’. This causes the root and one node to expand, as shown in the example at the top.

Setting Auto expand to a tree level

Alternatively, you can use the TreeLevel() function to expand only certain tree levels.

In this example, we only expand the top level of the tree, by using the expression

TreeLevel()=0

for the Control Properties -> Auto expand property.

We could have expanded the top two levels instead, by using the expression

TreeLevel()=0 or TreeLevel()=1

See also

The Online and Rich Client Samples projects (program TR08 and RTR08)

Reference
Attachment 
Attachment