How Do I Display Data in a Tree-format? (Magic xpa 3.x)
The tree format is a convenient way to display lists of data. It has become popular in the Windows environment, and users are familiar with it.
Magic xpa has an easy-to-use Tree control that you can use as needed. All you have to do is store your data in a hierarchically designed table (a memory table will do fine) and set the options you want. Here are the basic steps.
-
Store your data in the correct format for a tree. See How Do I Properly Define an Hierarchical Data Source that Will Fit a Tree Control Display?.
-
Create the Data View of the task, using the Tree data source as the Main Source, and selecting the columns that you need for the task (Node, Parent, etc.).
-
Select the Tree control from the Toolbox and drop it on the form. Size it as desired.
-
In the Control Properties for the tree, set the following options:
-
-
Node ID: The key for this particular record.
-
Parent ID: The key for the parent of this record.
-
Root Value: The very top record (here named ‘ROOT’).
-
Description variable: The value that displays on the tree.
That is all you need to do. If the data is correctly formatted, it will display as a table. There are other options you can set too, to control the look of the table and how it works in runtime; these are covered in other sections of this How-To.
How Do I Set Icons for the Tree Nodes?
How Do I Automatically Open the Tree with All Its Nodes or only Several Nodes Expanded?
The Online and Rich Client Samples projects (program TR01 and RTR01)