ADF Code Corner. 016-How-to customize the ADF Faces Table Filter. Abstract: twitter.com/adfcodecorner

Similar documents
ADF Code Corner. 70. How-to build dependent list boxes with Web Services Business Services. Abstract: twitter.com/adfcodecorner

ADF Code Corner How-to enforce LOV Query Filtering. Abstract: twitter.com/adfcodecorner

ADF Code Corner How-to bind custom declarative components to ADF. Abstract: twitter.com/adfcodecorner

ADF Code Corner How-to declaratively build a master-detail behavior with DVT components. Abstract: twitter.com/adfcodecorner

ADF Code Corner How-to build a reusable toolbar with Oracle ADF Declarative Components. Abstract: twitter.com/adfcodecorner

ADF Mobile Code Corner

ADF Code Corner How-to restrict the list of values retrieved by a model driven LOV. Abstract: twitter.com/adfcodecorner

ADF Code Corner How-to further filter detail queries based on a condition in the parent view using ADF BC. Abstract: twitter.

ADF Code Corner. 90. Filtering ADF bound lists. Abstract: twitter.com/adfcodecorner

ADF Code Corner How-to use the af:autosuggestbehavior component tag with ADF bound data sources. Abstract: twitter.

ADF Code Corner. 64. How-to implement a Select Many Shuttle with pre- selected values. Abstract: twitter.com/adfcodecorner

ADF Code Corner How-to show a glasspane and splash screen for long running queries. Abstract: twitter.com/adfcodecorner

ADF Code Corner. 048-How-to build XML Menu Model based site menus and how to protect them with ADF Security and JAAS. Abstract:

ADF Code Corner Implementing auto suggest functionality in ADF Faces. Abstract:

ADF Code Corner How-to launch a popup upon rendering of a page fragment in a region using JSF 2. Abstract: twitter.

ADF Code Corner. 65. Active Data Service Sample Twitter Client. Abstract: twitter.com/adfcodecorner

ADF Code Corner How to cancel an edit form, undoing changes with ADFm savepoints

ADF Code Corner. 71. How-to integrate Java Applets with Oracle ADF Faces. Abstract: twitter.com/adfcodecorner

The Tie That Binds: An Introduction to ADF Bindings

ADF Mobile Code Corner

ADF Hands-On. Understanding Task Flow Activities / 2011 ADF Internal Enterprise 2.0 Training. Abstract:

ADF Code Corner. Oracle JDeveloper OTN Harvest 01 / Abstract: twitter.com/adfcodecorner

ADF Mobile Code Corner

ADF Mobile Code Corner

ADF Code Corner. 97. How-to defer train-stop navigation for custom form validation or other developer interaction. Abstract: twitter.

ADF Code Corner. Oracle JDeveloper OTN Harvest 12 / Abstract: twitter.com/adfcodecorner

ADF Code Corner. Oracle JDeveloper OTN Harvest 10 / Abstract: twitter.com/adfcodecorner

ADF Code Corner. Oracle JDeveloper OTN Harvest 02 / Abstract: twitter.com/adfcodecorner

If you wish to make an improved product, you must already be engaged in making an inferior one.

Oracle ADF: The technology behind project fusion. Lynn Munsinger Principal Product Manager Application Development Tools Oracle Corporation

Oracle Fusion Middleware 11g: Build Applications with ADF Accel

<Insert Picture Here> Advanced ADF Faces. Frank Nimphius Principal Product Manager

ADF Code Corner. Oracle JDeveloper OTN Harvest 12 / 2011 & 01 / Abstract: twitter.com/adfcodecorner

Oracle Fusion Middleware 11g: Build Applications with ADF I

ADF Code Corner How-to use Captcha with ADF Faces and Oracle ADF. Abstract: twitter.com/adfcodecorner

ADF Code Corner. Oracle JDeveloper OTN Harvest 09 / Abstract: twitter.com/adfcodecorner

Developing an ADF 11g client for Agile PLM. Developing an ADF 11g client for Agile PLM

Oracle Retail Accelerators for WebLogic Server 11g

Oracle Developer Day

Rich Web UI made simple Building Data Dashboards without Code

Oracle Fusion Middleware 11g: Build Applications with ADF I

Oracle Middleware 12c: Build Rich Client Applications with ADF Ed 1 LVC

... AND UIX BEGAT ADF FACES: HOW RICH IS ADF FACES RICH CLIENT? Peter Koletzke, Quovera

ADF Desktop Integration 11g Release1 Component and Feature Demo

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.

Oracle Fusion Middleware

Oracle Application Development Framework Overview

We didn t need dialogue. We had faces.

Oracle Fusion Middleware

Mastering Oracle ADF Task Flows. Frank Nimphius Principal Product Manager Oracle JDeveloper / ADF

Oracle JDeveloper/Oracle ADF 11g Production Project Experience

Oracle WebCenter Hands-On Practices. A Practical Introduction to Oracle WebCenter

Overview. Principal Product Manager Oracle JDeveloper & Oracle ADF

Chapter 3. Windows Database Applications The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill

Oracle Fusion Middleware

Oracle Developer Day

Oracle Developer Day

Using JavaScript in ADF Faces Rich Client Applications

Oracle Exam 1z0-419 Oracle Application Development Framework 12c Essentials Version: 7.0 [ Total Questions: 87 ]

<Insert Picture Here> Oracle JHeadstart Forms2ADF - Overview

How To Create Employee With Designation Report In ADF Attractively

Oracle WebCenter Suite Integrating Secure Enterprise Search

Hello Worldwide Web: Your First JSF in JDeveloper

Oracle Fusion Middleware

Displaying Discussion Threads on WebCenter Pages

VERSION JANUARY 19, 2015 TEST STUDIO QUICK-START GUIDE STANDALONE & VISUAL STUDIO PLUG-IN TELERIK A PROGRESS COMPANY

Oracle Fusion Middleware

Achieving the Perfect Layout with ADF Faces RC

ADF Code Corner. Oracle JDeveloper OTN Harvest 04 / Abstract: twitter.com/adfcodecorner

ADF OAF Who Cares? You Do! Oracle Applications Framework / Application Development Framework - Which way do I go?

ADF Region Interaction: External Train Navigation

Oracle 1Z Oracle WebCenter 11g Essentials.

<Insert Picture Here> How to Debug Oracle ADF Framework Applications

Oracle Fusion Middleware

Using IBM Rational Business Developer wizards to create a Web application

<Insert Picture Here> Accelerated Java EE Development: The Oracle Way

Oracle Developer Day

Training Guide. Microsoft Excel 2010 Advanced 1 Using Conditional and Custom Formats. Applying Conditional Formatting

Oracle Fusion Developer Guide (ISBN: ) Preview Chapter 1. The Quick Lerner s Guide to Oracle Fusion Web Application Development PREVIEW

Oracle Fusion Middleware

Customizing Oracle Identity Governance: Populating Request Attributes

ADF ON RAMP: WHAT YOU NEED TO KNOW TO USE ADF

Microsoft Office Illustrated. Using Tables

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.

Copyright 2010, Oracle. All rights reserved.

The following instructions cover how to edit an existing report in IBM Cognos Analytics.

An Oracle White Paper June Guidelines for Creating Task Flows to Be Used in Oracle Composer-Enabled Pages

Building Database-Centric Web Applications Using. Oracle HTML DB

Access Review. 4. Save the table by clicking the Save icon in the Quick Access Toolbar or by pulling

DbSchema Forms and Reports Tutorial

<Insert Picture Here> JDeveloper Treasure Hunt

ArtOfTest Inc. Automation Design Canvas 2.0 Beta Quick-Start Guide

Windows Database Applications

MVC. Peter Koletzke, Quovera. Figure 1. MVC layers

Oracle Fusion Middleware

Oracle Business Intelligence Publisher

<Insert Picture Here> The Oracle Fusion Development Platform: Oracle JDeveloper and Oracle ADF Overview

CHAPTER. Introduction to the Oracle Application Development Framework

1Z0-430

Generating Wrappers with Fetch Agent Platform 3.2. Matthew Michelson and Craig A. Knoblock CSCI 548: Lecture 2

Transcription:

ADF Code Corner 016-How-to customize the ADF Faces Table Filter Abstract: ADF Faces tables can be created with a default table filter for users to further filter the result set of a query, which can be in memory or including re-querying the database. By default, table filters are shown as input text fields with no restriction on what users can type in as a filter pattern. The table filter components however can be customized by the developer to add missing user guidance, reducing the surface for user errors when working within ADF bound applications. This how-to demonstrates how to add an af:selectoncechoice as a filter component. twitter.com/adfcodecorner Author: Frank Nimphius, Oracle Corporation twitter.com/fnimphiu 03-AUG-2010

Oracle ADF Code Corner is a loose blog-style series of how-to documents that provide solutions to real world coding problems. Disclaimer: All samples are provided as is with no guarantee for future upgrades or error correction. No support can be given through Oracle customer support. Please post questions or report problems related to the samples in this series on the OTN forum for Oracle JDeveloper: http://forums.oracle.com/forums/forum.jspa?forumid=83 Introduction This article explains how to change the default table filter component in ADF Faces to a custom component renderer by the example of an af:selectonechoice. As shown in the image below, at the end of this how-to, the DepartmentId column can be filtered with a selectonechoice list, which is less error prone to use than a free text input. Creating a table To create a databound table, simply drag a collection like an ADF BC View Object from the Data Controls panel to the JavaServer Faces page. In the opened dialog, select table read-only table and make sure the filter option is selected so the table header shows filters in the column headers 2

As shown in the image above, the table filter is defined on the af:column. The default implementation of the table filter cell renderer is a an af:inputtext field. This allows users to type filter conditions in and query the table by hitting the enter key. To customize the filter, you can add an ADF Faces component to the filter facet, as shown in the image above. The component added to the facet then replaces the default filter for the column. For this article, we will change the default filter renderer with an af:selectonce choice component. About the table variable status Not many pay attention to a default setting on the ADF bound table, which is the varstatus attribute that is set to vs when dragging a collection as a filterable table to a JSF page. The vs variable is a handle to filter functionality and needs to be referenced from the customized table filter renderer. As shown in the image below, the status variable is displayed in the Columns section of the Property Inspector for the selected table. 3

Customizing the table filter To customize the table filter, select the filter facet of an af:column component and choose Insert inside filter from the right mouse context menu to add a select one choice component. You can finish the select one choice edit dialog without a configuration, except for clearing the label field. All configurations to make the select one choice work as a filter component will be done manually in the following. 4

The af:selectonechoice value attribute writes the selected list value as the filter criteria to the filter binding. To do so, select the value property in the Property Inspector and choose Expression Builder from the context menu as shown in the image below. 5

The filter criteria for a column is set using an EL string like #{vs.filtercriteria.<attribute name>}. To discover the attributes that are available to filter for a table, in the Expression Builder in Oracle JDeveloper, expand the JSP Objects node to access the vs node. Remember that the vs note is set as an attribute value on the table. So if the name differs, then you see a different value entry in the EL Builder. Expand the filtercriteria node and select the attribute name of the attribute that is represented by the table column to filter. In the example below, we are going to show a list of departments to help filtering the entries for a specific department. Having done this, the table now shows a selectonechoice component configured to set the table filter for the DepartmentId attribute. Next is to create the list of values. 6

In the example, instead of using a static list of values, we read the department names from an ADF binding so the list is produced dynamically. 7

To create the ADF binding for the list, select the Bindings tab at the bottom of the JSF page. In the binding editor, press the green plus icon in the Bindings section and choose tree from the list of Generic Bindings. The tree binding can be bound to a collection like Departments View Object in the example and return a list of values to display in the af:selectonechoice. Create a single level tree, as shown in the image above. Press the Add button to select a collection, which then implicitly creates an iterator, and then press the green plus icon to create the tree rule. 8

Form the available list of attributes, select at least one. In the example above, the plan is to show the department name to the user and internally use the department Id when filtering the table. Note: When the binding is created, navigate to the PageDef file and select the iterator that was created for the tree binding. The iterator is in the Executable section of the PageDef file. Select the iterator and open the Property Inspector. Change the RangeSize property from 10, the default value to -1, so the list shows all available list values Note: Be sensible with how many list values you show in the selectonechoice. If, for example, the departments table had 1 0000 0000 rows then an af:selectonechoice as the table filtering component is not a good choice. In this case you would use a LOV. To populate the af:selectonechoice components with values read from the ADF binding, we use an af:foreach component that iteratively created instance of f:selectitem components for each list entry. For this, you first remove the f:selectitems entry that is created when adding the af:selectoncechoice component. The page source should look as shown below 9

<af:column sortproperty="departmentid" filterable="true" sortable="true" id="c11" headertext="#{bindings.allemployees.hints.departmentid.label}"> <af:outputtext value="#{row.departmentid}" id="ot5"> <af:convertnumber groupingused="false" pattern="#{bindings.allemployees.hints.departmentid.format}"/> </af:outputtext> <f:facet name="filter"> <af:selectonechoice id="soc1" value="#{vs.filtercriteria.departmentid}"> <af:foreach var="listrow" items="#{bindings.alldepartments.rangeset}"> <f:selectitem id="si1" itemvalue="#{listrow.departmentid}" itemlabel="#{listrow.departmentname}"/> </af:foreach> </af:selectonechoice> </f:facet> </af:column> The af:foreach component references the ADF tree binding - #{bindings.alldepartments.rangeset}, which queries the Departments View Object for the available department Ids and names. The af:foreach component has a var attribute value defined as listrow, which is used to populate the select item label and value. At runtime the table shows as in the image below. The af:selectone Choice displays all departments for the user to choose from. 10

Download You can download the Oracle JDeveloper 11g sample for this how-to from the ADF Code Corner site: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html Make sure you configure the database connect to point to the HR schema of your Oracle database installation. RELATED DOCOMENTATION af:clientlistener - http://download.oracle.com/docs/cd/e15523_01/apirefs.1111/e12419/tagdoc/af_clientlistener.html af:table - http://download.oracle.com/docs/cd/e15523_01/apirefs.1111/e12419/tagdoc/af_table.html Oracle Fusion Developer Guide Oracle Press, McGraw Hill, by Frank Nimphius, Lynn Munsinger http://www.mhprofessional.com/product.php?isbn=0071622543 11