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 Java Development Tools.
Follow me:
Search

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