actionpoller in salesforce

Action poller acts as a timer in visuaflorce page. It is used to send an AJAX request to the server depending on the time interval (time interval has to be specified or else it defaults to 60 seconds).
In the action attribute a controller method gets called. The method gets called with a frequency defined by the interval atribute which has to be greater than 5 seconds.
In the following example action poller calls the method "CounterMethod" every 5 seconds where the variable "seconds" counter is updated. Rerender attribute refreshes the page block hence showing the updated value of variable "seconds".

Visualforce page


Time out can also be specified as an attribute in action poller. Once the time out point is reached it stops making AJAX callout to the server and controller method is no more called.

No comments:

Post a comment