<apex:actionPoller>
A timer that sends an AJAX update request to the server according to a time interval that you specify. The update request can then result in a full or partial page update. You should avoid using this component with enhanced lists.
Note that if an < apex:actionPoller >is ever re-rendered as the result of another action, it resets itself. An < apex:actionPoller > must be within the region it acts upon. For example, to use an < apex:actionPoller >with an < apex:actionRegion >, the < apex:actionPoller > must be within the < apex:actionRegion >.
Note that if an < apex:actionPoller >is ever re-rendered as the result of another action, it resets itself. An < apex:actionPoller > must be within the region it acts upon. For example, to use an < apex:actionPoller >with an < apex:actionRegion >, the < apex:actionPoller > must be within the < apex:actionRegion >.
Attribute | Description |
action | The action method invoked by the periodic AJAX update request from the component. Use merge-field syntax to reference the method. For example, action="{!incrementCounter}" references the incrementCounter() method in the controller. If an action is not specified, the page simply refreshes. |
enabled | A Boolean value that specifies whether the poller is active. If not specified, this value defaults to true. |
id | An identifier that allows the component to be referenced by other components in the page. |
interval | The time interval between AJAX update requests, in seconds. This value must be 5 seconds or greater, and if not specified, defaults to 60 seconds. Note that the interval is only the amount of time between update requests. Once an update request is sent to the server, it enters a queue and can take additional time to process and display on the client. |
oncomplete | The JavaScript invoked when the result of an AJAX update request completes on the client. |
onsubmit | The JavaScript invoked before an AJAX update request has been sent to the server. |
rendered | A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true. |
reRender | The ID of one or more components that are redrawn when the result of an AJAX update request returns to the client. This value can be a single ID, a comma-separated list of IDs, or a merge field expression for a list or collection of IDs. |
status | The ID of an associated component that displays the status of an AJAX update request. See the actionStatus component. |
timeout | The amount of time (in milliseconds) before an AJAX update request should time out. |
Example:
Visualforce Code:
Controller:
The above code generated the below page:
<apex:page controller="exampleCon"> <apex:form > <apex:outputText value="Watch this counter: {!count}" id="counter"/> <apex:actionPoller action="{!incrementCounter}" rerender="counter" interval="15"/> </apex:form> </apex:page>
Controller:
public class exampleCon { Integer count = 0; public PageReference incrementCounter() { count++; return null; } public Integer getCount() { return count; } }
The above code generated the below page: