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:
- In the test.transaction file, create
a child field element, of the root testData kColl, with tableName as
the identifier.
- Open the test.transaction file
in the Transaction editor.
- In the Data panel, right-click kColl
[testData], and then click .
- In the Id field of the Detailed
Information panel, enter tableName.
- Create a root iColl with tableData as
the identifier in the test.transaction file.
- Right-click in the Data panel,
and then click .
- In the Id field of the Detailed
Information panel, enter tableData.
- In the Size field of the Detailed
Information panel, enter 3.
- Create a child kColl, of the tableData iColl, with tableKeyName as
the identifier.
- In the Data panel, right-click iColl
[tableData], and then click .
- In the Id field of the Detailed
Information panel, enter tableKeyName.
- 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.
- In the Data panel, create a root kColl
element, and enter tableColumnName as the identifier
for the kColl.
- 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.
- Create two child refData elements for the root testData
kColl.
- In the Data panel, right-click kColl
[testData], and then click .
- In the RefId field of the Detailed
Information panel, click the Browse icon. The Select Data window is opened.
- In the Select Data window, expand Local,
and then click iColl [tableData]. Click OK.
- In the Data panel, right-click kColl
[testData], and then click .
- In the RefId field of the Detailed
Information panel, click the Browse icon. The Select Data window is opened.
- In the Select Data window, expand Local,
and then click kColl [tableColumnName]. Click OK.
- Define a context for the test.transaction file.
- In Transaction editor, click the Context tab.
- Right-click in the Context panel,
and then click .
- In the Id field of the Detailed
Information panel, enter testContext.
- In the Context panel, right-click
the context that you are defining, and then click .
- In the RefId field of the Detailed
Information panel, click the Browse button. The Select KeyedCollection window
is opened.
- In the Select KeyedCollection window,
expand Local, and then click kColl
[testData]. Click OK.
- Save the test.transaction file.
- In the Project Explorer view, right-click test.transaction,
and then click .
- Open an XUI file, and bind the XUI file to the testContext
context of the test.transaction file.
- 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.
- In the Properties view, click the Column tab.
- In the Columns panel of the Column tab,
click the Add icon to add three columns.
- 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.