1

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;} Apr 27, 2016 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, 2016 at 18:30
  • 1
    read this Apr 27, 2016 at 18:35
  • 1
    <apex:outputpanel id="notification"> <apex:outputText value="task: {!taskSize}"/> //more elements </apex:outputpanel> Apr 27, 2016 at 18:37

1 Answer 1

2

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, 2016 at 18:34
  • 1
    no it can't be achieved with only div tag. salesforce require apex component when you put that in rerender attribute.
    – Himanshu
    Apr 27, 2016 at 18:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .