Gayan Hewa
Gayan Hewa

Reputation: 2397

Primefaces p:poll tag

I am using the p:poll tag to display a live chart. I am using jfrecharts here so , basically the poll will update the image every 15 sec.

The problem is that i need to render an image soon as the page loads. But instead the poll delays from the first load. Is there any way to set the initial poll interval to Zero and for all other subseequent ajax calls poll with 15sec interval.

Regards,

Gayan

Upvotes: 0

Views: 2967

Answers (1)

Daniel
Daniel

Reputation: 37061

Invoke same action method (of the p:poll) on page load like described here:

JSF 2 invoke action method on page load

---OR---

You can execute the same action of the p:poll on page ready , for example make a button with same action , make it hidden and on page load you can .click() on this button with jQuery.

---OR---

Set the interval value to something like #{myBean.intervalValue} , and setting intervalValue into zero , and on the pool method check if its zero and if its so set it to 15 (dont forget to update the p:poll itself so it will reevaluate the intervalValue)

Upvotes: 1

Related Questions