<apex: actionPoller> Component in Visualforce PageThe <apex:actionPoller> component is a special type of component that works based on time and interval. It is a timer used for sending an AJAX request to the server according to the specified time interval. The <apex:actionPoller> component should be used within the region it acts upon. If we want to use the <apex:actionPoller> with the <apex: actionRegion>, the <apex:actionPoller> should be used within the <apex:actionRegion> component. In order to use the <apex:actionPoller> component, we have to go through the following consideration:
The <apex:actionPoller> component has the following attributes: 1. actionThe action attribute is of type ApexPages.Action that defines the action method. The action method is invoked by the periodic AJAX update request from the component. The page simply refreshes when there is no action method defined in this component. Syntax 2. enabledThe enabled attribute is of type Boolean that is used to specify the active and inactiveness of the <apex:actionPoller> component. By default, its value is set to true. Syntax 3. idThe id attribute is of type string that is a unique identifier allowing this component to be referenced by other components on the page. Syntax 4. intervalThe interval attribute is of type Integer that is used to specify the time interval between AJAX update requests in seconds. The value of this attribute must be 5 seconds or greater. By default, its value is set to 60 seconds. Syntax 5. oncompleteThe oncomplete attribute is used to specify the JavaScript method invoked when the result of an AJAX update request completes on the client. Syntax 6. onsubmitThe onsubmit attribute is used to specify the JavaScript method invoked before sending an AJAX update request to the server. Syntax 7. renderedThe rendered attribute is of type Boolean that is used to specify whether the current component is rendered on the page or not. By default, its value is set to true. Syntax 8. reRenderWhen we want to redraw one or more components on the page after receiving the result of an AJAX update request by the client, we use this component to specify the Ids of those components. Syntax 9. statusThe status attribute is of type string that is used for specifying the id of the component responsible for displaying the status of an AJAX update request. Syntax 10. timeoutThe timeout attribute is used for defining the amount of time before an AJAX update request should timeout. Syntax Let's take an example to understand how we can use the <apex:actionPoller> component in VF: ApexActionPollerExample.vfp ApexActionPollerController.apxc Output Next Topicapex:component in Visualforce page |