i am using prime-faces 3.2. Ajax polling is not get stopped, i am using stop attribute to stop the polling and i am trying to stop it form the bean using getter and setters for stop. Even i have used java script to stop but i can't. Any solution to stop polling?
Asked
Active
Viewed 1.2k times
2
-
2Wow... you really should start marking answers as "Correct" for your previous answers. – SJuan76 Aug 31 '12 at 10:51
-
http://www.primefaces.org/showcase/ui/pollStartStop.jsf – Daniel Aug 31 '12 at 13:19
3 Answers
6
this code works like a charm in my case:
<p:poll interval="2" update="flightsTable" widgetVar="poll"
autoStart="false" listener="#{searchFlightBean.checkIfSearchCompleate}"/>
Method in searchFlightBean:
public void checkIfSearchCompleate() {
if(searchCompleate) {
RequestContext reqCtx = RequestContext.getCurrentInstance();
reqCtx.execute("poll.stop();");
}
}
-
1poll call will get stopped. but in firebug i can able to see the call running.it get stopped only after page refresh – wild Sep 04 '12 at 10:17
-
1
<p:poll id="checkListPoll" interval="2" process="@none"
update="checkList" widgetVar="chkList"/>
<h:panelGroup id="checkList"> ... </h:panelGroup>
You can use this from controller to stop ajax requests:
PrimeFaces.current().executeScript("PF('chkList').stop()"); //after Primefaces 7.0
or with older Primefaces version:
import org.primefaces.context.RequestContext;
...
RequestContext.getCurrentInstance().execute("PF('chkList').stop()"); //before Primefaces 7.0

martoni
- 11
- 3
0
My solution:
<h:panelGroup id="chartPanel">
<h:graphicImage value="#{resource['img:loading.gif']}"
rendered="#{!indexController.chartReady}">
<p:poll interval="1" update="chartPanel" autoStart="true" />
</h:graphicImage>
<p:chart id="chart" type="line" model="#{indexController.chartModel}"
rendered="#{indexController.chartReady}" />
</h:panelGroup>
The polling is stopped when chartReady is true, no futher code in the bean

Nolle
- 201
- 2
- 5