Tuesday Nov 24, 2009

Passing Value Between Pages to Filter a View Object

A frequent question we get from beginners is how to I choose a value on one page and pass it to another page to show a specific record or set of records.
In previous blog posts I showed how easy it is to do this when you are using the same view object on both pages - using the setCurrentRowWithKey operation, and In another entry I showed how to use an execute with params before a page loads to filter the data in that page.

But on OTN someone asked how do you do this when you use two different views on the two pages. This would be a combination of both techniques - but using a parameter passing instead of setCurrentRow operation.
So here is a little video showing the basic technique.
We are going to use a pageFlowScope variable to pass the value from one page to the filtering method (executeWithParam) and then to the second page.

Friday Jan 09, 2009

Preventing Queries When Page First Loads

When you are dealing with big sets of data or complex queries you sometime want to prevent the automatic execution of a query that happens when you bind a table or form in an ADF page to a data control.
Common example is if you have a VO query that depends on a parameter and you have a single page where you let people insert the parameter (using executeWithParams for example) and see the data below it in a table.
The first time you run the page you don't want the table to be populated.
(This is quite a common question on the OTN discussion forum also).

The solution is to have a condition associated with the refresh condition of the iterator that displays the data in your page.
In the ADF Developer Guide for 10.1.3 it is explained under: Controlling Whether Data Appears Initially
And the achieve it by using the ${adfFacesContext.postback == true} expression.

In 11 there is a new variable that does the same it's name is adfFacesContext.initialRender and the EL you would use would be: #{!adfFacesContext.initialRender}

To try it out take the VO based on Departments and drop it on your page as a form - now run the page and you'll see data.
Now go into the binding editor and fill out the value #{!adfFacesContext.initialRender} for the iterator.
binding001.gif

If you run the page again, the Form would be empty.

Note - in some cases this solution is not enough - a safer bet would be to use a condition that checks if the parameter that you need to pass to the method is empty - see the blog entry - Delay Method Execution When Using ADF Binding

 

 

About

me
I'm a Director of Product Management for the Oracle Mobile and Development Tools.
Follow me:
Search

Archives
« May 2016
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    
       
Today