To specify the data objects to use in a table, you can use EL syntax data binding expressions. See "Data Binding in ADF UIX" in the ADF UIX Developer's Guide for details.
You can create databound tables using databound UI components provided by the Oracle Application Development Framework (Oracle ADF) bindings. When you work with the Data Control Palette to quickly assemble databound tables, ADF UIX automatically updates the model attributes for you.
Example:
...
<table model="${bindings.EmpView1}" id="EmpView18">
<contents>
<column>
<columnFormat columnDataFormat="numberFormat"/>
<columnHeader>
<sortableHeader model="${ctrl:createSortableHeaderModel(bindings.EmpView1,'Empno')}"/>
</columnHeader>
<contents>
<messageTextInput model="${uix.current.Empno}" columns="10" readOnly="true">
<onSubmitValidater>
<decimal/>
</onSubmitValidater>
</messageTextInput>
</contents>
</column>
...
</contents>
<tableSelection>
<singleSelection model="${bindings.EmpView1Iterator}" text="Select and ">
<primaryClientAction>
<firePartialAction targets="EmpView18" source="EmpView18" event="select"/>
</primaryClientAction>
</singleSelection>
</tableSelection>
</table>
...
For more details about ADF bindings and the Data Control Palette, see:
Note that a column stamp doesn't change for each table row, that is, the type of content that is stamped in each column cell is similar, e.g., a button component. But the content itself may be different, e.g., the text inside each button component varies from row to row. Data binding is used in tables to change the contents of a table on a per-row basis.
Data binding works in a table because a column stamp attribute can be bound to the current DataObject instead of a specific, named DataObject. The table changes the current DataObject when it renders each table row. By binding the column stamp attribute to the same key on the current DataObject, the content changes in every table row.
Using inline data the following UIX XML code renders a table with two columns and three rows. The tableData attribute is bound to inline data under the name "demoTableData". The "demoRowData" DataObjectList comprises three DataObjects. Each cell in the first table column is stamped by a text child. The value of text is bound to the result returned from querying the current DataObject with the key 'firstColumnText'. Each cell in the second column is stamped by a button child. The value of the button text is bound to the result returned from querying the current DataObject with the key 'secondColumnText'.
In addition, each element in the table DataObjectList is used as the "current" DataObject for its corresponding row. The number of rows UIX knows to stamp down a column is determined by the size of this DataObjectList. Thus, UIX renders each column stamp once for every DataObject in the DataObjectList.
Example:
<dataScope xmlns="http://xmlns.oracle.com/uix/ui">
<provider>
<data name="demoTableData">
<inline>
<demoRowData firstColumnText="First row" secondColumnText="First Button"/>
<demoRowData firstColumnText="Second row" secondColumnText="Second Button"/>
<demoRowData firstColumnText="Third row" secondColumnText="Third Button"/>
</inline>
</data>
</provider>
<contents>
<table name="table1"
tableData="${uix.data.demoTableData.demoRowData}">
<contents>
<column>
<contents>
<!-- first column stamp -->
<text text="${uix.current.firstColumnText}"/>
</contents>
</column>
<column>
<contents>
<!-- second column stamp -->
<button text="${uix.current.secondColumnText}"/>
</contents>
</column>
</contents>
</table>
</contents>
</dataScope>
By separating the data (or model) from the appearance (or view) of the table, you can change the appearance of the table by changing the column stamps, and later plug in any data source to supply the stamps with data.
The code above produces the following table:
You can also build DataObjectLists in Java and provide them as data for your tables in UIX.
Example:
<dataScope ... >
<provider>
<data name="demoTableData">
<method class="test.MyTable" method="getTableData" />
</data>
</provider>
<contents>
<table tableData="${uix.data.demoTableData}">
...
</table>
</contents>
</dataScope>
About Table Structure and Stamps
About Databound UIX Pages
Creating a Table
Creating a Struts-based Web Application with Oracle ADF
Creating a Model 1 Style Web Page with Oracle ADF
Working with Table Components
Copyright © 1997, 2004, Oracle. All rights reserved.