How to start ajaxPoll after click.

UI Components for JSF
Post Reply
peter
Posts: 27
Joined: 10 Mar 2010, 16:18

11 Mar 2010, 17:06

Hi everyone! I'm using ajax poll component on page, and i want to start the polling after click on a certain button, and stop it after job on the server ist finished.
To stop the polling i know that i can use for exp: requestContext.addCallbackParam, but what i have to do, to make the poll component not starting after the page load?
PS. i'm using 2.0.1SNAPSHOT with tomcat 6.20 and mojarra2.0 jsf implementation.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

11 Mar 2010, 17:14

Hi,

There is start and stop client side API. See example;

http://www.primefaces.org:8080/prime-sh ... rtStop.jsf

But I don't think it is just enough, you need an attribute like autoStart right where you can set to false for your poll so that it will start whenever you want it using client side API?

peter
Posts: 27
Joined: 10 Mar 2010, 16:18

11 Mar 2010, 22:00

Exactly!I need autostart="false" attribute in poll component, but how to do that? I'm new in Primefaces, and also not advanced in JSF at all. Any suggestion where to start?
I did try with this script (included in body and in head section of the page):

Code: Select all

<script type="txt/javascript">PrimeFaces.onContentReady('myPollComponent', function(){myPollComponent.stop()})</script>

to stop the poll just after the page is loaded, but it did not help. Firebug showed me that the script was invoked, but polling didn't stop.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

12 Mar 2010, 12:14

This needs to be handled on PrimeFaces side so I've created a ticket;

http://code.google.com/p/primefaces/iss ... ail?id=610

Star the issue if you'd like to get notifications.

Probably this change will be ready by monday next week and then you can get it in a nightly build so stay tuned a bit ;)

peter
Posts: 27
Joined: 10 Mar 2010, 16:18

12 Mar 2010, 13:46

Cool! Thank you VERY much!
BTW. I'm really impressed by primefaces.Before i have used Devexpress and ICEFaces components in my work, but Primefaces are much better then those.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

12 Mar 2010, 14:06

Thank you, I'd appreciate when you have time, write a short testimonial so we can put it our homepage.

http://primefaces.prime.com.tr/forum/vi ... ?f=3&t=531

I'll also update this post when autoStart feature is added.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

13 Mar 2010, 12:57

Good news, this feature is added.

You just need to set autoStart to false.

Code: Select all

<p:poll autoStart="false" widgetVar="mypoll" />
And then on demand, you can start polling with mypoll.start() and mypoll.stop() javascript api.

You would need a nightly build to get this feature.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 22 guests