Thursday, June 29, 2017

Ajax implementation with ActionStatus in visualforce page?

Visualforce Page:

<apex:page controller="exampleCon">
<apex:form >
<apex:outputText value="Watch this counter: {!count}" id="counter"/>
<apex:actionStatus startText=" (incrementing…)" stopText=" (done)" id="counterStatus" />
<apex:actionPoller action="{!incrementCounter}" rerender="counter" status="counterStatus" interval="05"/>
</apex:form>
</apex:page>

Apex Class Controller:

public class exampleCon {
Integer count = 0;

public PageReference incrementCounter() {
count++;
return null;
}

public Integer getCount() {
return count;
}
}

No comments:

Post a Comment