To bind data to a table or a list box, you can:
Create the structure of your table or list box as you define the data source
Add data sources to widgets in a UI component
Nexaweb recommends you create a static representation of the data source to use for creating the bindings, put this static representation in your application project, and then redirect your data source to the actual file that serves the data to the UI later.
To bind data to a table or list box, follow these steps:
1. Open the UI file to which you want to add a data source in Nexaweb Data Perspective.
You can customize the perspective to close default views or to open other views such as the Navigator view.
2. Lay out the perspective so that Outline view appears on top of Package Explorer and the Navigator view on top of the Data view.
3. Open the UI file containing the UI component to which you want to add data.
4. You can drag one of the following as a data source onto the UI component to which you want to add a data source (this example uses an XML file):
XML file from Navigator view
Java class from Package view
5. The Create Data Source Wizard appears. Specify an ID for this data source and RefreshOnAttribute and StructureChange settings. (See Creating a Data Source for information on completing this wizard.)
6. Right click on the data source file in Navigator view and select Open With > XML Editor.
Note: Use the XML Editor not the oXygen XML Editor or some other default editor.
7. Display the data source file in the Visual Editor along side the UI component file by dragging the data source file tab either to the right or down until you see a drag outline of the entire file appear, then release it.
8. Drag data from under the root node of the data source file onto the UI widget where you want the UI to display the data. The Create Iterator wizard appears. Specify a unique name for the iterator and a select statement to access it from the data source. Click Next. (For detailed information on completing this wizard, see Creating an Iterator.)
9. The Field Binding and Widget Settings dialog appears.
Specify which data you want to bind to which widgets on the UI and modify the select statement for that data, if desired. Click Next.
10. The Field Settings dialog appears. See Creating an Iterator.
Modify the field names under which the UI displays this data, if desired. Also, specify an attribute of the associated widget to which to bind the data, if desired. Click Finish.
11. If you bound data to a table, the table displays rows for each piece of data you bound to it, with each row labeled with the field name specified on the Field Settings dialog.
If you run the file, the table appears similar to the following: