How Do I Set the Tree Control to Display the Expand Button only in the Relevant Nodes that Actually Have Child Nodes? (Magic xpa 3.x)
|
|
Node Preload = No
|
Node Preload = Yes
|
By default, each node of a tree has a small ‘+’ or ‘-’ button next to it. Clicking on a ‘+’ will expand a node, and clicking on a ‘-’ will collapse the node. However, initially all the nodes will have a ‘+’ in front of them, because the engine has not fetched any of the subrecords and so does not “know” if any exist. Once the user clicks on the node, the ‘+’ will disappear if there are no subrecords.
You can change this behavior by instructing the engine to preload all the records in the tree. Then the leaf nodes will be correctly marked, with no expand button.
-
Select the Tree control.
-
Set Control Properties -> Node Preload to True.
Now the expand and collapse buttons will only show when they are relevant.
Note: Setting Node Preload to True might make the tree take perceptibly longer to load if there are a lot of records.
How Do I Show/Hide the Expand/Collapse Buttons?
The Online and Rich Client Samples projects (program TR09 and RTR09)