Introduction to Partial Page Rendering

Rerendering Partial Page Content 7-3 Figure 7–1 The Search Button Causes Results Table to Rerender Trigger components must inform the framework that a PPR request has occurred. On command components, this is achieved by setting the partialSubmit attribute to true. Doing this causes the command component to fire a partial page request each time it is clicked. For example, say a page includes an inputText component, a commandButton component, and an outputText component. When the user enters a value for the inputText component, and then clicks the commandButton component, the input value is reflected in the outputText component. You would set the partialSubmit attribute to true on the commandButton component. However, components other than command components can trigger PPR. ADF Faces input and select components have the ability to trigger partial page requests automatically whenever their values change. To make use of this functionality, use the autoSubmit attribute of the input or select component so that as soon as a value is entered, a submit occurs, which in turn causes a valueChangeEvent event to occur. It is this event that notifies the framework to execute a PPR, as long as a target component is set. In the previous example, you could delete the commandButton component and instead set the inputText component’s autoSubmit attribute to true. Each time the value changes, a PPR request will be fired. Note: In some cases, you may want a component to be rerendered only when a particular event is fired, not for every event associated with the trigger component, or you may want some logic to determine whether a component is to be rerendered. In these cases, you can programatically enable PPR. For more information, see Section 7.3, Enabling Partial Page Rendering Programmatically. 7-4 Web User Interface Developers Guide for Oracle Application Development Framework Once PPR is triggered, any component configured to be a target will be rerendered. You configure a component to be a target by setting the partialTriggers attribute to the relative ID of the trigger component. For information about relative IDs, see Section 3.5, Locating a Client Component on a Page. In the example, to update the outputText in response to changes to the inputText component, you would set its partialTriggers attribute to the inputText component’s relative ID.

7.2.1 How to Enable Partial Page Rendering

For a component to be rerendered based on an event caused by another component, it must declare which other components are the triggers. To enable a component to rerender another component: 1. In the Structure window, select the trigger component that is, the component whose action will cause the PPR: ■ Expand the Common section of the Property Inspector and set the id attribute if it is not already set. Note that the value must be unique within that component’s naming container. If the component is not within a naming container, then the ID must be unique to the page. For more information about naming containers, see Section 3.5, Locating a Client Component on a Page. Tip: The autoSubmit attribute on an input component and the partialSubmit attribute on a command component are not the same thing. When partialSubmit is set to true, then only the components that have values for their partialTriggers attribute will be processed through the lifecycle. The autoSubmit attribute is used by input and select components to tell the framework to automatically do a form submit whenever the value changes. However, when a form is submitted and the autoSubmit attribute is set to true, a valueChangeEvent event is invoked, and the lifecycle runs only on the components marked as root components for that event, and their children. For more information, see Section 4.3, Using the Optimized Lifecycle. Note: Certain events on components trigger PPR by default, for example the disclosure event on the showDetail component and the sort event on a table. This means that any component configured to be a target by having its partialTriggers attribute set to that component’s ID will rerender when these types of events occur. Note: If your trigger component is an inputLov or an inputComboBoxLov, and the target component is an input component set to required, then a validation error will be thrown for the input component when the LOV popup is displayed. To avoid this, you must use programmatic partial page rendering. For more information, see Section 7.3, Enabling Partial Page Rendering Programmatically.