Poll

Poll lets you repeat a server action or simply render/execute any component on a set interval with an optional delay before the first call is made. The Widget API provides methods to stop and start the poller as well.

Tip: Make sure the Ajax request doesn't update the poller itself, as that would result in the intial delay being applied to each poll interval. For this reason, the default render value is null and the default execute value is @this.

Server time: Sat Aug 08 16:13:17 CEST 2020
Example
Documentation

<h:form id="pollForm">
    <h:outputText value="Server time: #{controller.now}" id="time"/>
    <t:poll interval="1000" widgetVar="poller" render="time"/>
</h:form>

<div>
    <button class="success" onclick="TW('poller').start();">Start poller</button>
    <button class="alert" onclick="TW('poller').stop()">Stop poller</button>
</div>

Poll lets you repeat a server action or simply render/execute any component on a set interval with an optional delay before the first call is made. The Widget API provides methods to stop and start the poller as well.

Info
Tag name poll
Component type io.tornadofaces.component.Poll
Renderer type io.tornadofaces.component.PollRenderer
Attributes
NameDescriptionRequired
intervalThe number of milliseconds between each poll.true
onloadStart the poller on DOM load. Defaults to true.false
delayThe number of milliseconds before the first poll.false
onloadStart the poller, optionally after the specified delay on DOM load. Defaults to true.false
actionThe action to call every time while interval is reachedfalse
renderSpace separated list of components to render after ajax. Defaults to null".false
executeSpace separated list of components to execute on ajax. Default "@this".false
oncompleteJavaScript callback triggered before the AJAX request is sentfalse
oncompleteJavaScript callback triggered after AJAX response has arrivedfalse
onsuccessJavaScript callback triggered after DOM update based on AJAX requestfalse
renderedShould this component be rendered?false
Client Side API

Widget: TornadoFaces.widget.Poll

Method Params Return type Description
start() boolean Start the poller. Return true if the poller was started, false if the poller was already running.
stop() boolean Stop the poller. Return true if the poller was stopped, false if the poller was not running.