2-20 Java EE Developers Guide for Oracle Application Development Framework
with the new sort order will not be created, so the sort order on the page will remain the same.
To work around this issue, you can either configure the iterator so that it does not cache the results, or you can place a button on the page that can be used to reexecute
the iterator when the page is refreshed. If your page does not have a button whose action attribute can be bound to a method, then you can use an invokeAction
executable that will be invoked whenever the page is refreshed.
To set an iterator to not cache its result set: 1.
Open the page definition file, and in the Structure window, select the iterator whose results should not be cached.
2. In the Property Inspector, expand the Advanced section and set CacheResults to
false
.
To use a button to reexecute the iterator: 1.
From the ADF Faces page of the Component Palette, drag and drop a Button onto the page.
2.
In the Structure window, right click the button and in the context menu, choose Bind to ADF Control
.
3.
In the Bind to ADF Control dialog, expand the accessor associated with the iterator to reexecute, expand that accessor’s Operations node, and select Execute.
To use an invokeAction to reexecute the iterator: 1.
Open the page definition file, and in the Structure window, right-click executables and choose Insert inside executables invokeAction.
2. In the Insert invokeAction dialog, set id to a unique name. Use the Binds
dropdown list to select the iterator to be reexecuted.
3. With the newly created invokeAction still selected, in the Property Inspector, set
Refresh to prepareModel.
This setting will cause the accessor method to be invoked during the Prepare Model phase. This refreshes the binding container.
4. Set RefreshCondition to an EL expression that will cause the refresh to happen
only if any value has actually changed. If this condition is not set, the invokeAction
will be called twice. For example, the expression {userState.refresh and
adfFacesContext.postback} will cause the refresh to happen only if the
page is refreshed.
Note: If your page uses the navigation operations to navigate
through the collection, do not set CacheResults to false, as that navigation will no longer work. You must use a button to reexecute
the iterator. For more information about the navigation operations, see Section 3.4, Incorporating Range Navigation into Forms.
Performance Tip: If you set an iterator to not cache its result set, and
that result set is a collection that may return a large number of rows, performance will be negatively affected. For large result sets, you
should use an invokeAction.
Using ADF Model Data Binding in a Java EE Web Application 2-21
For more information about the page lifecycle phases and using the refresh and refreshCondition
attributes, see The JSF and ADF Page Lifecycle section of the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application
Development Framework.
2.3.5 What You May Need to Know About Configuring Validation