Binding data to a tree widget

This section provides an example of how to bind data to a tree widget.

Before you begin

The procedure in this topic is an example of how to bind data to a tree widget. To complete this example, you must first create a sample test.transaction file, and then create a kColl as a root data container. Enter testData as the identifier for the kColl.
Note: Every .transaction file must contain at least one kColl as a root data container.
For information on how to create a .transaction file, refer to the Creating a transaction file topic. For information on how to create a kColl as a root data container in the .transaction file, refer to the Defining data for a transaction flow topic.

Procedure

To bind data to a tree widget, do the following steps:

  1. In the test.transaction file, create a new child field element for the root testData kColl.
    1. Open the test.transaction file in the Transaction editor.
    2. In the Data panel, right-click kColl [testData], and then click New Child > field.
    3. In the Id field of the Detailed Information panel, enter TreeName.
  2. Create a root kColl in the test.transaction file.
    1. Right-click in the Data panel, and then click New Child > kColl.
    2. In the Id field of the Detailed Information panel, enter rootTree.
  3. Create a child refData element for the root testData kColl.
    1. In the Data panel, right-click kColl [testData], and then click New Child > refData.
    2. In the RefId field of the Detailed Information panel, click the Browse icon. The Select Data window is opened.
    3. In the Select Data window, expand Local, and then click kColl [rootTree]. Click OK.
  4. Define a context for the test.transaction file.
    1. In Transaction editor, click the Context tab.
    2. Right-click in the Context panel, and then click New Child > context.
    3. In the Id field of the Detailed Information panel, enter testContext.
    4. In the Context panel, right-click the context that you are defining, and then click New Child > refKcoll.
    5. In the RefId field of the Detailed Information panel, click the Browse button. The Select KeyedCollection window is opened.
    6. In the Select KeyedCollection window, expand Local, and then click kColl [testData]. Click OK.
  5. Save the test.transaction file.
  6. In the Enterprise Explorer pane, right-click the test.transaction file, and then select Transaction Editor > Generation BTT Transaction XML.
  7. Open an XUI file, and bind the XUI file to the testContext context of the test.transaction file.
  8. In the XUI editor, place a Tree widget into the XUI editor area, and then bind the dataName property of the tree widget to treeName, and bind the dataNameForTreeContent property of the tree widget to rootTree.

Results

Data is bound to the Tree widget.