0

I am using action poller to update a number on the vf page.

<div id='notification'>{!taskSize}</div>

actionpoller code:

<apex:actionFunction action="{!actionItemsFiltered}" name="popup"/>
            <apex:actionRegion >
                <apex:actionPoller action="{!actionItemsFiltered}" reRender="notification" interval="5"/>
            </apex:actionRegion>
            <apex:outputPanel styleClass="custPopup" layout="block" rendered=""/>
            <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!showPopup}" >
                <apex:dataTable value="{!taskReturnList}" var="task" id="theTable" styleClass="tableClass">
                    <apex:column >
                        <apex:facet name="header">Task</apex:facet>
                        <apex:outputText value="{!task.Subject}" style="font-weight:800"/>
                    </apex:column>
                </apex:dataTable>
            </apex:outputPanel>

Controller method:

global static pagereference actionItemsFiltered()
    {
        taskReturnList = [SELECT Id, AccountId, Subject, Type FROM Task WHERE type IN ('anurag', 'Repeat CST') LIMIT 50000];
        taskSize = taskReturnList.size();
        showPopup = true;
        system.debug('1size:'+taskSize);
        return null;    
    }

I set the interval in actionpoller for 5 sec. I can see debug logs for every 5 sec by which i can say that the method is executing everytime, but the counter on page is not changing.

What am I doing wrong here?

4
  • 1
    add to vf: <apex:outputText value="task: {!taskSize}" id="notification"/> and to apex: public Integer getTaskSize() {return taskSize;} – Ilya Lepesh Apr 27 '16 at 18:25
  • Cool this worked, but why can't i achieve the same when the outputtext is in div tag as i have in my code? – Anurag Apr 27 '16 at 18:30
  • 1
    read this – Ilya Lepesh Apr 27 '16 at 18:35
  • 1
    <apex:outputpanel id="notification"> <apex:outputText value="task: {!taskSize}"/> //more elements </apex:outputpanel> – Ilya Lepesh Apr 27 '16 at 18:37
1

Update your div line with

<apex:outputpanel id="notification">{!taskSize}</apex:outputpanel>
2
  • It works this way, but couldnt i get the same with div? – Anurag Apr 27 '16 at 18:34
  • no it can't be achieved with only div tag. salesforce require apex component when you put that in rerender attribute. – Himanshu Apr 27 '16 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.