p:poll creates new unmeant divs after backend update

UI Components for JSF
Post Reply
StarHabit
Posts: 6
Joined: 12 Sep 2017, 09:55
Location: Germany
Contact:

12 Sep 2017, 10:12

Good morning friends

I've got the following problem (and after reading point 5 over here I'm using a Wildfly Server Version Full 11.0.0.Alpha1 with Mojarra 2.2.13.SP3 and PrimeFaces 6.0):

I've got a <p:poll> element inside a <p:accordionPanel> (of course also inside a <h:form> - detailed construction check out the code below). The accordionPanel element is updated from the backend as soon as a <p:commandLink> is pressed. Everything works fine, but after updating the accordionPanel it seems like another poll is created because in the same rhythm (1 Second) a new div is created... I can't find any clue where to look or even how to fix this behavior. As you can see in the code I also tried to stop any newly created poll - but without success. Are there any ideas?

Thank you very much guys!

Code:
[index.xhtml - shortened]

Code: Select all

<p:accordionPanel activeIndex="null" id="todoListe" value="#{todo.todos}" var="t">
	<p:ajax event="tabChange" listener="#{todo.onTabChange}" />
	<p:ajax event="tabClose" listener="#{todo.onTabClose}" />
	<p:tab>
	<!-- overrides title on tab-->
		<f:facet name="title">
				<h:form style="display: initial;">
					<div style="float: right; margin-right: 3%; width: 25%;">
					<p:commandLink action="#{todo.checkTodo()}" onclick="if(PrimeFaces.widgets['widget_countdownPoll']){PF('widget_countdownPoll').stop();}">
					<p:graphicImage value="/resources/images/hook.svg" styleClass="checkTodo" id="hook" />
					</p:commandLink>
					</div>
				</h:form>
				<h:outputText value="#{t.title}" />
				<h:form styleClass="noUpdate">
					<h:outputText id="txt_count" value="#{t.remainingTime}" styleClass="#{t.busted ? 'notBusted' : 'busted'}" />
					<p:poll interval="1" listener="#{t.setRemainingTime}" update="txt_count" id="countdownPoll" />
				</h:form>
			</f:facet>
		[...]
	</p:tab>
</p:accordionPanel>
[CheckTodo-Method]

Code: Select all

[Database-Stuff]
RequestContext.getCurrentInstance().update("todoListe");
RequestContext.getCurrentInstance().update("testGauge"); //not important for this problem in my eyes
RequestContext.getCurrentInstance().update("rankColumn"); //not important for this problem in my eyes
RequestContext.getCurrentInstance().execute("$('.GaugeXP').gaugeMeter();"); //not important for this problem in my eyes
RequestContext.getCurrentInstance().execute("$('.GaugeTodo').gaugeMeter();"); //not important for this problem in my eyes
Looking for a way to stay organized with your habits and todos?
-> StarHabit is your place to go! Reach for the stars!

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

12 Sep 2017, 15:12

2 forms in a title of a tab of an accordion panel with commandLink and one with a poll updating things is not that common (it is really uncommon). Try if you can put the poll somewhere else...

StarHabit
Posts: 6
Joined: 12 Sep 2017, 09:55
Location: Germany
Contact:

12 Sep 2017, 15:25

Yes I already feared such an answer - but thank you! The second h:form was a try to give the poll its own one btw.

When I put the poll somewhere else (to be extreme: near the root e.g.) how could I access the outputText fields which has to be updated? I mean, which identifier should I have to use?

Thanks!
Looking for a way to stay organized with your habits and todos?
-> StarHabit is your place to go! Reach for the stars!

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

12 Sep 2017, 21:01


kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

12 Sep 2017, 21:02

And you sure you don't have nested forms (e.g. that accordion panel also being in a form...)

StarHabit
Posts: 6
Joined: 12 Sep 2017, 09:55
Location: Germany
Contact:

13 Sep 2017, 09:11

Good morning,

yes - I double checked it and there are no more nested forms.
kukeltje wrote:
12 Sep 2017, 21:01
that PF also has https://www.primefaces.org/showcase/ui/ ... ctor.xhtml
That made my day! I actually don't know how I could miss this for so long :roll: Thanks mate - that solved my problem!
Looking for a way to stay organized with your habits and todos?
-> StarHabit is your place to go! Reach for the stars!

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 38 guests