Binding data to a table widget

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

Before you begin

The procedure in this topic is an example of how to bind data to a table 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 table widget, do the following steps:

  1. In the test.transaction file, create a child field element, of the root testData kColl, with tableName as the identifier.
    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 tableName.
  2. Create a root iColl with tableData as the identifier in the test.transaction file.
    1. Right-click in the Data panel, and then click New Child > iColl.
    2. In the Id field of the Detailed Information panel, enter tableData.
    3. In the Size field of the Detailed Information panel, enter 3.
  3. Create a child kColl, of the tableData iColl, with tableKeyName as the identifier.
    1. In the Data panel, right-click iColl [tableData], and then click New Child > kColl.
    2. In the Id field of the Detailed Information panel, enter tableKeyName.
  4. In the Data panel, right-click kColl [tableKeyName], and then create three child field elements. Enter Name, Gender, and Salary as the identifiers for the three child field elements.
  5. In the Data panel, create a root kColl element, and enter tableColumnName as the identifier for the kColl.
  6. In the Data panel, right-click kColl [tableColumnName], and then create three child field elements. Enter Name, Gender, and Salary as the identifiers for the three child field elements.
  7. Create two child refData elements 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 iColl [tableData]. Click OK.
    4. In the Data panel, right-click kColl [testData], and then click New Child > refData.
    5. In the RefId field of the Detailed Information panel, click the Browse icon. The Select Data window is opened.
    6. In the Select Data window, expand Local, and then click kColl [tableColumnName]. Click OK.
  8. 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.
  9. Save the test.transaction file.
  10. In the Project Explorer view, right-click test.transaction, and then click Transaction Editor > Generate BTT Transaction XML.
  11. Open an XUI file, and bind the XUI file to the testContext context of the test.transaction file.
  12. In the XUI editor, place a table widget into the XUI editor area, and then bind the dataName property of the table widget to tableColumnName, and bind the dataNameForList property of the table widget to tableData.
  13. In the Properties view, click the Column tab.
  14. In the Columns panel of the Column tab, click the Add icon to add three columns.
  15. In the Columns panel, select a column, and then click the Browse icon of the Data name field to bind the column to the data that you defined in the test.transaction file.

Results

Data is bound to the table widget.