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

Similar documents
ADF Code Corner. 64. How-to implement a Select Many Shuttle with pre- selected values. 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. 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 use the af:autosuggestbehavior component tag with ADF bound data sources. Abstract: twitter.

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

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. 016-How-to customize the ADF Faces Table Filter. Abstract: twitter.com/adfcodecorner

ADF Mobile Code Corner

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

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 show a glasspane and splash screen for long running queries. Abstract: twitter.com/adfcodecorner

ADF Mobile Code Corner

ADF Mobile Code Corner

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

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

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. 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 build a reusable toolbar with Oracle ADF Declarative Components. Abstract: twitter.com/adfcodecorner

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

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

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

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

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

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

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

Oracle Fusion Middleware 11g: Build Applications with ADF Accel

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

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

ADF Region Interaction: External Train Navigation

The Tie That Binds: An Introduction to ADF Bindings

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

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

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

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

1z0-554qa88. Number: Passing Score: 800 Time Limit: 120 min File Version: 1.0. Oracle 1z0-554

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

Oracle Retail Accelerators for WebLogic Server 11g

PassGuide..1z0-554_81,Q&A

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

Oracle Fusion Middleware 11g: Build Applications with ADF I

CIS 764 Tutorial: Log-in Application

Building Rich Enterprise JSF Applications with Oracle JHeadstart for ADF (11.1.1)

Oracle Developer Day

Oracle Fusion Middleware 11g: Build Applications with ADF I

Rich Web UI made simple Building Data Dashboards without Code

Building Extendable Oracle ADF Applications with Embedded Mule ESB. Miroslav Samoilenko. January 2008

Overview. Principal Product Manager Oracle JDeveloper & Oracle ADF

Customizing Oracle Identity Governance: Populating Request Attributes

Different color bars chart with Popup Box in ADF

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

Oracle ADF 11g: New Declarative Validation, List of Values, and Search Features. Steve Muench Consulting Product Manager Oracle ADF Development Team

ORACLE JHEADSTART 12C for ADF

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

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

Oracle Fusion Middleware

Getting started with ADF 11g

ADF Mobile : Data Services Java Beans. Ma Ping

Oracle Application Development Framework Overview

Case Study: Redeveloping an Oracle Forms application using Oracle JDeveloper and Oracle ADF

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

Oracle ADF Faces Cookbook

Oracle WebCenter Suite Integrating Secure Enterprise Search

Building J2EE Applications with Oracle JHeadstart for ADF

1Z0-430

Oracle 1Z Oracle9i Forms Developer: New Features.

Oracle Developer Day

ADF Desktop Integration 11g Release1 Component and Feature Demo

TUTORIAL: ADF Faces (Part 1-Modified) Passing parameter values between JSF pages By: Dr.Ahmad Taufik Jamil, Pusat Teknologi Maklumat, HUKM

Oracle Fusion Middleware

Oracle Fusion Middleware

Oracle 1Z Oracle WebCenter 11g Essentials.

ER/Studio Enterprise Portal User Guide

<Insert Picture Here> Oracle JHeadstart Forms2ADF - Overview

Take Your Oracle Forms on the Road Using ADF Mobile. Mia Urman, OraPlayer & Denis Tyrell, Oracle Corporation

MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9)

We didn t need dialogue. We had faces.

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

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

Oracle JDeveloper/Oracle ADF 11g Production Project Experience

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

Apps Exception Problem Building Schema Jdeveloper

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

<Insert Picture Here> The Latest E-Business Suite R12.x OA Framework Rich User Interface Enhancements

ActiveVOS Fundamentals

Prototype 1.0 Specification

OES Permission Checks in ADF Task Flows

Oracle Fusion Middleware

Oracle Fusion Middleware Developing Extensions for Oracle JDeveloper. 12c ( )

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

Oracle Fusion Middleware

Oracle Forms Modernization Through Automated Migration. A Technical Overview

Oracle SQL Developer Workshop

Implementing a Numerical Data Access Service

User Guide Using AuraPlayer

Getting Started with Web Services

Report Designer Report Types Table Report Multi-Column Report Label Report Parameterized Report Cross-Tab Report Drill-Down Report Chart with Static

Managing Your Database Using Oracle SQL Developer

Transcription:

ADF Code Corner 90. Filtering ADF bound lists Abstract: Falling into the category of dependent lists, is the use case of reducing list entries based on previous user entries. The ADF JUCtrlListBinding class exposes a method filterlist that when called constructs a a view criteria for the underlying list collection. This blog article shows two examples for using this API. One sample filters the available value list in a select many shuttle component. The other sample filters a single select list based on a previous user entry in an input text field. twitter.com/adfcodecorner Author: Frank Nimphius, Oracle Corporation twitter.com/fnimphiu 30-OCT-2011

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 A common use case is to filter list data dependent on user provided data entries. This article explains how to filter the af:selectmanyshuttle and af:selectonechoice list. The first sample shows an input text field that If you provide a valid department Id in, filters the list of all employees shown in the af:selectmanyshuttle accordingly. In the image below, the list is filtered for employees in department 60. Changing the department Id to 20, as shown below, changes the list of employees to only show employees that are in department 20. 2

The second example uses the autosubmit functionality on an input text field to reduce the list of employees shown in the select one choice component. Filtering the ADF Faces Select Many Shuttle To add ADF bound ADF Faces select many shuttle components to a view, you drag a collection EmployeesView1 in this sample from the Data Controls panel onto the page and choose Multiple Selection ADF Select Many Shuttle from the popup menu. Implicitly this creates a list binding in the PageDef binding file of the view. The list binding is configured on the af:selectmanyshuttle component to produce the list and also hold the selected values. 3

To update the business service with the user selection, you usually listen for a value change event or program the submit button action to access the list binding's JUCtrlListBinding instance. The image below shows the list binding configuration used in this sample. The employee first name and last name is displayed to represent EmployeeId as the list data. Though not in the focus of this article, the action code associated with the Read Selected command button shows how to access the user selected data. Similar, the Reset Selection shows how to unset the user selection, for example to refresh a form for the next user selection. The method filterlistaction shown below is invoked by the Filter List button. It access the list binding named "EmployeesView1" in the PageDef file and creates a HashMap with the filter keys and data. The key in this example is "DepartmentId" to indicate that the department id attribute is used for filtering the list. The value of the filter is provided through the user entry. Having configured the sample to access the HR schema, you want to try 20, 30, 50, 60, 80 (Note that for the sample I did not implement validation for the user entry. So garbage in produces garbage out) When applying the HashMap content as a filter to the JUCtrlListBinding instance, ADF creates a view criterion that then is applied to the list query. (Code below is taken from SelectManyShuttleBean.java of this sample) public String filterlistaction() { BindingContext bctx = BindingContext.getCurrent(); BindingContainer bindings = bctx.getcurrentbindingsentry(); JUCtrlListBinding listbinding = (JUCtrlListBinding)bindings.get("EmployeesView1"); HashMap m = new HashMap(); try { m.put("departmentid", new Number (departmentid)); catch (SQLException e) { //TODO handle exception gracefully e.printstacktrace(); 4

listbinding.getdciteratorbinding().getviewcriteria().clear(); //remove selected values before filtering listbinding.clearselectedindices(); listbinding.filterlist(m); return null; Note: The code above clears the view criteria added to a View object before applying the filter. If the View Object has an existing view criteria applied that should be kept, change this code to only remove the criteria added lasts. Filtering the ADF Faces Select One Choice The same filtering used with ADF Faces select many components bound to ADF can be used for single select bindings. In the image below, an ADF Faces select one choice is dropped into an Employee edit for to replace the ManagerId input field with an af:selectonechoice. The list is chosen to be a Dynamic List (see image below) and wired up to a View Object that queries the Employees table. 5

The DepartmentId field autosubmit property is set to true so that a change in the department value automatically updates the model. The ManagerId af:selectonechoice PartialTriggers property is configured to point to the DepartmentId field ID to establish PPR refresh on value change. Set the immediate property of the Note: Check the ChangeEventPolicy property of the iterator binding the forms is bound to. If the setting is "ppr", set it back to "none". When the department id value is changed by a user, the new department value is used to filter the list displayed in the af:selectonechoice component. The code is exactly the same as used in the select many shuttle sample. (Code Below is taken from SelectListBean.java of the Sample) private String filterlistaction(string departmentvalue) { BindingContext bctx = BindingContext.getCurrent(); BindingContainer bindings = bctx.getcurrentbindingsentry(); JUCtrlListBinding listbinding = (JUCtrlListBinding) bindings.get("managerid"); //clear selection to avoid selectd values that don't match the //filter criteria HashMap m = new HashMap(); try { m.put("departmentid", new oracle.jbo.domain.number(departmentvalue)); catch (SQLException e) { e.printstacktrace(); listbinding.getdciteratorbinding().getviewcriteria().clear(); listbinding.filterlist(m); return null; Note: The sample also uses a JSF component binding ("Binding" attribute reference to a managed bean) to trigger the initial filtering of the list after page load. The code is contained in the SelectListBean.java source. Sample Download The Oracle JDeveloper 11.1.1.4 workspace for the sample shown in this article can be downloaded as sample #90 from ADF Code Corner: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html Configure the database connection of the sample to access the Oracle database HR schema before running SelectManyShuttle.jspx or SelectOneChoice.jspx from the adfc-config.xml task flow. 6

Known Issues Oracle JDeveloper 11g R2 has a known issue with this solution, which I filed for development investigation. So for now, use this sample with Oracle JDeveloper 11g R1 (11.1.1.x). RELATED DOCOMENTATION 7