Activity Forums Salesforce® Discussions Refresh a particular output panel in some specific interval of time in Salesforce Visualforce Page

  • Adarsh

    Member
    January 10, 2018 at 1:49 pm

    Hello Piyush,

    There is a remarkable attribute within <apex:actionPoller> component is "enabled". With the use of this attribute, you may achieve your requirement.

    Visual Force Page - 

    <apex:page controller="Referesh_A_Certain_At_Sertain_TimeCtrl">
    <style>
    .Processing{
    position: fixed;
    background: url('/img/loading32.gif');
    background-repeat: no-repeat;
    background-position: center;
    width: 100%;
    height: 100%;
    z-index: 10004;
    left: 0%;
    top: 0%;
    }
    </style>
    <apex:form >
    <apex:actionStatus id="idStatus" startStyleClass="Processing" ></apex:actionStatus>
    <apex:actionPoller action="{!increment}" rerender="count" interval="5" enabled="{!IF(count < 0,false,true)}" status="idStatus" />

    <apex:outputPanel id="count">
    {!IF(count < 0,false,true)}
    {!count}
    </apex:outputPanel>
    </apex:form>
    </apex:page>

    Controller -

    public class Referesh_A_Section_At_Certain_TimeCtrl{
    public Decimal count {get; set;}
    public Referesh_A_Section_At_Sertain_TimeCtrl(){
    count = 0;
    }
    public void increment(){
    count++;
    }
    }

    Hope it helps 🙂

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos