• KHouseknecht
  • NEWBIE
  • 0 Points
  • Member since 2004

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

I'm trying to set the Interval attribute of the ActionPoller component from a property in the underlying controller.  When I check the generated HTML, I see it defaults to 60,000ms, which is the default value if you don't specify a value for Interval.  If I hard code a value, say 5 secs, in the ActionPoller, then I see the correct 5,000ms in the generated HTML.  Here is the VF and Apex sample that demonstrates the faulty behavior:

 

<apex:page controller="PollerTestController" > 
<apex:form > 
    <apex:actionpoller interval="{!RefreshInterval}" action="{!testAction}" rerender="counter" /> 
    <apex:outputtext value="{!Count}" id="counter" />
    <br/>
    Interval: <apex:outputtext value="{!RefreshInterval}" />
</apex:form> 
</apex:page>

 

public class PollerTestController 
{
    
    integer m_count = 0; 
    
    public integer RefreshInterval
    {
        get{return 5;}
        set;
    }
    
    public void testAction() 
    { 
        m_count++; 
    } 
    
    public integer Count {get{return m_count;}}
    
}

 The generated JavaScript showing the default 60,000ms pollinterval value:

 

<script type="text/javascript">
A4J.AJAX.Poll('j_id0:j_id1',{'pollId':'j_id0:j_id1:j_id2','similarityGroupingId':'j_id0:j_id1:j_id2','parameters':{'j_id0:j_id1:j_id2':'j_id0:j_id1:j_id2'} ,'pollinterval':60000} );
</script>

 

If I change the ActionPoller to:

 

<apex:actionpoller interval="5" action="{!testAction}" rerender="counter" /> 

 Then I get:

 

<script type="text/javascript">
A4J.AJAX.Poll('j_id0:j_id1',{'pollId':'j_id0:j_id1:j_id2','similarityGroupingId':'j_id0:j_id1:j_id2','parameters':{'j_id0:j_id1:j_id2':'j_id0:j_id1:j_id2'} ,'pollinterval':5000} );
</script>

 Why is the ActionPoller seemingly ignoring the value coming from the property? 

 

NOTE:  I've already tried getter/setter methods instead of the property syntax, at the request of Salesforce Developer Support, since he told me that Apex uses getter/setter and doesn't have property syntax.  Really?  How long have I been writing Apex code? :)   And that doesn't work either.

 

 

 

I'm trying to set the Interval attribute of the ActionPoller component from a property in the underlying controller.  When I check the generated HTML, I see it defaults to 60,000ms, which is the default value if you don't specify a value for Interval.  If I hard code a value, say 5 secs, in the ActionPoller, then I see the correct 5,000ms in the generated HTML.  Here is the VF and Apex sample that demonstrates the faulty behavior:

 

<apex:page controller="PollerTestController" > 
<apex:form > 
    <apex:actionpoller interval="{!RefreshInterval}" action="{!testAction}" rerender="counter" /> 
    <apex:outputtext value="{!Count}" id="counter" />
    <br/>
    Interval: <apex:outputtext value="{!RefreshInterval}" />
</apex:form> 
</apex:page>

 

public class PollerTestController 
{
    
    integer m_count = 0; 
    
    public integer RefreshInterval
    {
        get{return 5;}
        set;
    }
    
    public void testAction() 
    { 
        m_count++; 
    } 
    
    public integer Count {get{return m_count;}}
    
}

 The generated JavaScript showing the default 60,000ms pollinterval value:

 

<script type="text/javascript">
A4J.AJAX.Poll('j_id0:j_id1',{'pollId':'j_id0:j_id1:j_id2','similarityGroupingId':'j_id0:j_id1:j_id2','parameters':{'j_id0:j_id1:j_id2':'j_id0:j_id1:j_id2'} ,'pollinterval':60000} );
</script>

 

If I change the ActionPoller to:

 

<apex:actionpoller interval="5" action="{!testAction}" rerender="counter" /> 

 Then I get:

 

<script type="text/javascript">
A4J.AJAX.Poll('j_id0:j_id1',{'pollId':'j_id0:j_id1:j_id2','similarityGroupingId':'j_id0:j_id1:j_id2','parameters':{'j_id0:j_id1:j_id2':'j_id0:j_id1:j_id2'} ,'pollinterval':5000} );
</script>

 Why is the ActionPoller seemingly ignoring the value coming from the property? 

 

NOTE:  I've already tried getter/setter methods instead of the property syntax, at the request of Salesforce Developer Support, since he told me that Apex uses getter/setter and doesn't have property syntax.  Really?  How long have I been writing Apex code? :)   And that doesn't work either.