• peaklor
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hi,

 

I am calling a method from my controller every 5 seconds.

But I want to dynamically change the interval by adding a custom setting and calling the custom setting in apex class and

referring that in the interval attribute of actionpoller.

 

But when I tried that, the method is not getting called every 5 seconds. It is taking the default interval as 60 seconds.

 

I also tried by creating an Integer variable in the controller and called that in the interval attribute of actionpoller.

 

Following is my code which I am trying:

public class exampleCon {
    Integer count = 0;
     Integer interval=5;                   
    public PageReference incrementCounter() {
        count++;
        return null;
    }
    public Integer getinterval(){
        return interval;
    }                 
    public Integer getCount() {
        return count;
    }
}

 

<apex:page controller="exampleCon">
    <apex:form >
        <apex:outputText value="Watch this counter: {!count}" id="counter"/>
        <apex:actionPoller action="{!incrementCounter}" rerender="counter" interval="{!interval}"/>
    </apex:form>
</apex:page>

 

 

Please let me know any suggestions.

 

Thanks

Arvind