First page Back Continue Last page Text

oracle adf workshop


Enabling PPR Programmatically

If you need to execute some logic to determine whether a component should be refreshed, you cannot handle the refresh using partial triggers, but need to use a different technique.

Also, if you need to refresh a component only when a certain event occurs (such as when the selection changes), and not when other events are triggered, using partial triggers may not be the most efficient method to use, because when you use partial triggers the component is refreshed for all events that are fired by those trigger components. For example, a table supports multiple events, such as sorting and selecting events. Similarly, for components that display the results of complicated queries, if you want to refresh the component only when the selection changes, a more efficient way than using partial triggers is to use a selection listener.

The addPartialTarget() method enables you to add a component as a partial target for an event, so that when that event is triggered, the partial target component is refreshed. With this technique, you can associate the component you want to have refreshed with the event that is to trigger the refresh.

The following example, part of a managed bean, adds a UI component as a partial target :

public void doPartialRefresh(UIComponent uc){ AdfFacesContext adfctx = AdfFacesContext.getCurrentInstance(); adfctx.addPartialTarget(uc);}