Skip to main content
This revision made June 14, 2013 13:56, by steven.davelaar

ADF Samples - Table, Tree and TreeTable

Main Table of Contents


Row Selection

ACC100 How-to undo table row selection in case of custom validation failure {11.1.1.x] 22-MAR-2012
ACC099 Multi Table Row Selection for Deferred Delete {11.1.1.x] 02-MAR-2012
LBO004 Using the ActiveRowKey property {11.1.2] 31-AUG-2011
ACC083 How-to create bi-directional synchronization between a tree and an input form component {11.1.1.x] 23-MAY-2011
ACC075 How-to select multiple parent table rows and synchronize a detail table with the combined result {11.1.1.x] 28-FEB-2011
LBO011 Select all rows in an ADF table {11.1.1.x] 29-JUL-2010
ABA052 Dynamic Row Selection for ADF Table Component {11.1.1.x] 04-APR-2010
ACC050 How-to create and synchronize edit forms for tree node entries {11.1.1.x] 29-MAR-2010
ACC023 How-to build a Generic Selection Listener for ADF bound Tables {11.1.1.x] 17-MAR-2010
SMU142 Passing RowIterator of Selected Tree Node to AM Method {11.1.1.0] 20-JAN-2009 SCOTT(Modified) schema
This example illustrates the correct way to operate on the possibly multiple view link accessor rowsets of a tree binding. A very common mistake developers make is that they write application module custom methods that operate on a view object instance in the datamodel, only to be surprised when the changes they've made are not reflected in the tree on the page. Their approach fails because the ADFM tree binding uses view link accessor rowsets rather than data model view link instances to work with detail rows. To understand the difference, read section 35.1.3 Understanding View Link Accessors Versus Data Model View Link Instances in the 11g Dev Guide. To make this point extremely clear, the example's AppModule contains only a single view instance in the data model called Departments. The data model does not contain any view link instance or any "Employees" view instance. While those are useful for some master/detail UI scenarios, they are not needed/used-by a tree binding. Instead, the tree binding materializes the employee rows in each department by directly interacting with each DeptView row's view link accessor attribute, producing separate EmpView row sets for each of the distinct department rows that the user expands to see the details for. The example depends on a slightly modified version of the usual EMP and DEPT tables called DEPT_RANK and EMP_WITH_RANK. The latter table contains one additional column named EMP_RANK which is used to order the employees in a given department. You should run the included CreateTables.sql script in your SCOTT account before trying the demo. A few interesting points that the demo shows off is the use of the generic TableSupportBean which exposes some useful properties to the EL expression language like selectedNodeRowIterator and selectedNodeRowKey. The method action bindings in the page definition for the TreePage.jspx page reference these properties in order to declaratively pass the correct RowIterator and the key of the selected row in the table to the application module custom methods which resequence the selected employee's rank either up or down. Also note that in the Tuning section of the General panel for the DeptView view object, the Retain View Link Accessor Rowset checkbox is checked on. This setting is required for the tree binding to correctly reflect programmatic manipulations in the pending transaction made by developer-written code in the AM.
SMU134 Passing Multiple Selected Keys from Tree, Table, and TreeTable to Application Module Method {11.1.1.6.0] 07-NOV-2008 , Upd: 02-NOV-2011
|A common requirement in pages containing table, tree, or treeTable components is to allow the user to select multiple rows and then carry out some operation on the selected rows. This example illustrates the best-practice declarative approach to accomplish this. First of all, notice that the code that processes the rows is correctly encapsulated inside the AppModule application module's custom java class, and that both the processSelectedEmployees() and processSelectedDepartments() methods are exposed on the client interface so they are available for declarative data binding in the data control palette. Notice they these accept a java.util.Set (which we expect at runtime to contain oracle.jbo.Key objects. The reason we're not using Java generics like Set<Key> in the method signature is that the ADFBC client interface mechanism does not yet support using generics in the method signature. The implementation of these methods processes the set passed in, casting each object in the set to a Key and then using the findByKey() on the appropriate view object instance in the data model to find the row by its key and then act on it. There are two pages in the demo view1.jspx and view2.jspx. Start by looking at the view2.jspx page, which includes a table of DeptView rows from the view object instance named Departments. Importantly, notice that to enable the multi-select on the table three required steps have been taken: (1) The rowSelection attribute is set to "multiple", (2) the selectedRowKeys attribute has been removed, and (3) the selectionListener has been removed. Steps (2) and (3) are automatically setup to support single-row selection and must be removed whenever you enable multiple row selection in the table, or else the multiple selection will not work correctly. The custom processSelectedDepartments method was dropped from the Data Control Palette onto the page as a button, and the EL expression for the method argument is set to ${View2.se­lectedAdfRo­wKeys[View­2.myTable]} which makes use of a generic helper backing bean that the ViewController project includes to simplify working with multiple selection in tables, trees, and treeTables. The View2 backing bean is defined in adfc-config.xml and rather than using a specific backing bean class for the View2 page, its using the generic helper class MultiSelectSupportBackingBean. That bean conveniently contains a property named myTable of type RichTable which is designed to be referenced by the binding property of a page containing a RichTable where you'd like to perform some processing on its multiple-selection. In fact, if you look at the binding property of the af:table component in the view2.jspx page, you'll see that it's set to this property using the expression #{View2.myTable}. So the ${View2.selectedAdfRowKeys[View­2.myTable]} expression used as the parameter value of the declarative method action binding accesses the selectedAdfRowKeys Map-valued property of the backing bean, passing the View2.myTable instance of the RichTable on that page as the map key. As you can see in the MultiSelectSupportBackingBean class, the selectedAdfRowKeys is an anonymous subclass of java.util.Hashmap that overrides the get() method to perform a custom operation when the EL expression evaluator tries to access the map's properties. In effect, this pattern allows us to introduce something that works like a custom function that accepts one argument into our EL expressions. In this case, the argument is the UI component for which you'd like a Set of selected Keys. The view1.jspx page shows the same generic MultiSelectSupportBackingBean class in use as the page's View1 backing bean, and three different instances of method action bindings in the page definition for view1.jspx are used to invoke the processSelectedEmployees() custom method with the appropriate UI component passed as the "argument" to the EL expression to reference the Set of selected Keys. A last thing to note about the example is how the EmployeeHierarchy view object instance in the data model is setup. Notice that the EmpView view object defines a view criteria named EmployeesWithNoManager that finds employees that have a Mgr attribute equal to null. The EmployeeHierarchy view object instance was added to the data model in the application module editor, then I used the (Edit) button just above the Data Model tree to edit that view object instance to apply the EmployeesWithNoManager view criteria to it. This means that initially the view object will only show employees with no manager (e.g. KING). Then, due to the presence of the test.model.links.Manages view link between EmpView and itself, based on the Empno->Mgr relationship, the direct reports of the employees with no manager will appear as children in the tree and treeTable due to the related tree binding rules that uses the DirectReports view link accessor attribute to access the nested child collections of direct reports rows at each recursive level. Notice as well that there are no view link instances required in the data model to work with the tree or treeTable since the related tree bindings use the view link accessor attributes to get detail information, and not data model view instances linked via view link instances in the data model. I highly recommend reading section 35.1.3 Understanding View Link Accessors Versus Data Model View Link Instances to help understand the important distinction.

See also ADF Code Corner articles 025. Building a generic SelectionListener for ADF trees and ADF BC models, 026. How-to access the selected row data in ADF bound TreeTable and Tree and 096. How to invoke a table selection listener from Java and Steve Muench' undocumented 10.1.3.x samples 104, 122, 128.

Table

THA020 Make Disclosed Row the Current Row when using a Detail Facet of a Table {11.1.1.7.0] 13-APR-2013
This sample shows how to make the disclosed row the current row when using a detail facet of an af:table
THA017 JDev 11.1.1.7.0: Table Pagination: Beware of the Layout Container {11.1.1.7.0] 03-APR-2013
This sample shows the different behavior of an af:table in 'page' mode in different layout containers
DSI021 How many rows Modified/Added in ADF Table {11.1.2.2.0] 07-AUG-2012 [c ]
I was reading through OTN Discussion Forums where I found one topic "How many rows were Modified/Added in ADF Table by the user". Jobinesh has written article on "Displaying Transaction Log When User Commits a Transaction" which explains how to get the entity status, above example overrides EntityImpl::doDML(int operation, TransactionEvent e) method to track the status of entities.
DSI019 How to add a new row at the end of the ADF Table {11.1.2.0.0] 02-JUL-2012
SDA008 Control-Break Style ADF Table - Comparing Values with Previous Row {11.1.1.6] 04-JUN-2012
DSI015 Configure Comparison of Row Objects at Run Time {11.1.2.0.0] 03-JUN-2012
Recently I was working in an application where I need to compare two or more row objects based on selected attributes. In this article I will explain one of the way to configure comparison of row objects at run time, so this pattern will give users the ability to select row objects for comparison and to define which of the available attributes they want to compare at run time.
DSI014 Bean DataControl - Create new table rows based on existing row content {11.1.2.0.0] 01-JUN-2012
The Create a Duplicate row enables the user to create an object by duplicating an existing object. The duplication aids the user by prefilling some values. The user has full control and can change any of the values during the creation process. So in this article, I'm will show how can we create new table rows based on existing rows using Bean Data Control.
DSI009 Bean DataControl - Edit table records {11.1.2.0.0] 16-MAY-2012
Here is a scenario where we need to edit the table records and update them, here table is based on Bean DataControl. so in this article, I'm trying to explain how can we edit the table records using Bean DataControl.
DSI006 Display multiple selected rows from ADF table in a popup window {11.1.2.0.0] 11-MAY-2012
DSI001 Custom Table Pagination Using EJB Native Query {11.1.2.0.0] 20-APR-2012
Let us take scenario where the table has more records. Here employees table has more number of records, if the entire records are displayed in single ADF table, It will be difficult for user to navigate or traverse to the exact record. This can be achieved by implementing pagination, Pagination is an important aspect when displaying large number of records. This blog would be of help if you are building applications that render large number of records in a table. With pagination, the number of records displayed can be controlled into several manageable chunks, thus making it easy to locate the records of interest.
ABA134 Oracle ADF 11g Table Insert with Empty Insert Row {11.1.1.x] 25-NOV-2011
LJE027 Creating an ADF Faces Dynamic Table with multi-faceted Head-to-Head comparison between records {11.1.2] 02-JUL-2011
ABA115 ADF 11g R2 Improvement - ADF Table AutoHeightRows Property {11.1.2] 26-JUN-2011
ABA109 Oracle ADF 11g Custom Table Pagination {11.1.1.x] 08-MAY-2011
LBO014 SelectOneRadio in Table Layout {11.1.1.x] 11-NOV-2010
ACC060 How-to implement drag and drop for an ADF Faces table {11.1.1.x] 11-OCT-2010
LBO013 Import From Excel Into an ADF Table {11.1.1x] 16-SEP-2010
ACC056 How-to handle and respond to mouse double clicks in ADF Faces tables {11.1.1.x] 09-SEP-2010
JPU031 A short cut to display row numbers for each record on UI {11.1.1.3] 30-JUL-2010
ABA072 ADF Table AutoHeightRows Property {11.1.1.x] 09-JUL-2010
JPU024 Create row on a clickToEdit table {11.1.1.3] 10-JUN-2010
ACC012 How-to copy/paste the value of a table cell to other - selected - table rows {11.1.1.x] 01-JUN-2010
JPU023 Conditional rendering of editor components for a clickToEdit table {11.1.1.3] 28-MAY-2010
JPU022 Displaying an empty table ! {11.1.1.3] 15-MAY-2010
ABA053 Changed Row Highlighting in Oracle ADF Table {11.1.1.x] 06-APR-2010
ABA036 Auto Commit Use Case in Oracle ADF 11g Table Component {11.1.1.x] 12-JAN-2010
ACC028 How-to scroll an ADF bound ADF Faces Table using a Keyboard Shortcut {11.1.1.x] 08-JAN-2010
ACC051 How-to scroll ADF tables using an alphabetic index menu {11.1.1.x] 06-JAN-2010
LJE017 Cell Highlighting in JSF-based Rich Enterprise Apps (Part 1) {11.1.1.x] 01-NOV-2008
LJE018 Implementing Cell Highlighting in JSF-based Rich Enterprise Apps (Part 2) {11.1.1.x] 01-NOV-2008

See also section User Interface Patterns
See also section Searching - Sorting - Filtering Data
See also ADF Code Corner article 013. How-to declaratively create new table rows based on existing row content and Steve Muench' undocumented 10.1.3.x samples nr. 103

Tree and TreeTable

ABA205 Check Box Support in ADF Tree Table Different Levels {11.1.2.3.0] 18-NOV-2012
DRM002 Traversing an ADF Tree Binding with Iterators {11.1.1.6] 02-JUL-2012
Simple Example showing how the various levels encoded into an ADF Tree Binding can be teased apart using conventional af:iterator tags accessing the .children attribute of each level of the tree
ABA138 ADF Tree - How to Autoselect/Deselect Checkbox {11.1.1.x] 15-DEC-2011
ABA137 ADF Tree - How to Add Checkbox {11.1.1.x] 12-DEC-2011
ACC084 Dynamically show or hide af:treeTable columns dependent on the disclosed node {11.1.1.x] 30-JUN-2011
JPU066 Programmatically refreshing the child nodes of an <af:tree> {11.1.1.4] 16-APR-2011
ACC078 How-to programmatically expand trees and tree table components upon initial rendering and later {11.1.1.x] 06-APR-2011
JPU060 Programmatically disclosing nodes in a <af:tree> {11.1.1.4] 19-MAR-2011
ACC021 How-to initially expand tree nodes in ADF bound tree & tree table {11.1.1.x] 23-AUG-2010
ACC032 Creating a tree table from a single View Object and access selected rows {11.1.1.x] 05-MAY-2010
ABA045 How To Traverse ADF Tree {11.1.1.x] 27-FEB-2010
ABA028 Tree Table Component in Oracle ADF {11.1.1.x] 23-NOV-2009
LBO006 Dropping trees {11.1.1.x] 10-JUL-2008

See also section User Interface Patterns
See also ADF Code Corner article 020. Expanding an af:tree node by clicking onto the node label

Difference compared to previous revision
(No Modifications)
 
 
Close
loading
Please Confirm
Close