+ Start a Discussion
paul-lmipaul-lmi 

Using actionpoller with a controller method that needs a parameter to be set

Is it possible to use apex:param as a child of actionpoller so that more than one action poller can be used on a single page, each calling a controller method with a specific variable value being set, eg, nest an actionpoller inside an apex:repeat, and pass the controller a variable that's different for each, and have the rerendered section (also in teh repeat) use this set variable to show a different set of items?

 

Practical use, populating multiple lists of items from multiple web services API calls, all on teh same page, and all via AJAX.

bob_buzzardbob_buzzard

According to the docs: 

 

 

The <apex:param> component can only be a child of the following components:
• <apex:actionFunction>
• <apex:actionSupport>
• <apex:commandButton>
• <apex:commandLink>
• <apex:outputLink>
• <apex:outputText>

 

The <apex:param> component can only be a child of the following components:

• <apex:actionFunction>

• <apex:actionSupport>

• <apex:commandButton>

• <apex:commandLink>

• <apex:outputLink>

• <apex:outputText>

 

You might have more success using javascript timeouts with apex:actionFunction components.

paul-lmipaul-lmi

Does actionfunction allow me to set a param/property in the conrollter prior to executing the controller method it's bound to, similar to how you'd use apex:param in actionsupport.

bob_buzzardbob_buzzard

It does allow that.

 

That said, there appears to be an issue around apex:param in winter 11 - I've just had to add rerender attributes to my commandbuttons to get the parameter to be passed to the controller.

Pradeep_NavatarPradeep_Navatar

You can use apex:actionPoller to refresh the time for visual force component apex:outputText.

 

Tryout the sample code given below :

 

VF CODE:

        <apex:outputText value="The unformatted time right now is: {!propDT}" />

        <apex:actionPoller action="{!refresh}" reRender="t1" interval="5"/>

 

Controller Code:

           String datetimeStr = '';

           public String propDT { get { return datetimeStr; } set { datetimeStr = value; }}

           public void refresh()

           {

                     datetimeStr = String.valueOf(DateTime.Now()).split(' ')[1];

           }

 

Hope this helps.

paul-lmipaul-lmi

well aware of that Pradeep.  i was specifically looking to use actionpoller with some kind of hack/workaround for passing in an apex:param, not just s simple beginner's example on how to use apex:actionpoller...

Chirag MehtaChirag Mehta
Paul - Any luck or solution around this ? to use action:poller inside repeat and call a method by passing param with diff value on each iteration ??