Kutluhan Metin
Kutluhan Metin

Reputation: 59

Primefaces poll updates whole form instead of the desired component

I have a dashboard in my form which includes three panels and each of them needs to get updated with different intervals:

For this purpose I'm trying to use Primefaces poll component:

myPage.xhtml: (Primefaces version: 5.2)

<h:form id="myForm">

    <p:poll interval="65" update=":panel1" listener="#{myBean.updatePanel1}"/>

    <p:poll interval="30" update=":panel2" listener="#{myBean.updatePanel2}" />

    <p:poll interval="45" update=":panel3" listener="#{myBean.updatePanel3}" />

    <p:dashboard id="board" model="#{bean.dashboardModel}">
        <p:panel id="panel1" header="Panel 1">
            <p:chart id="myPieChart" type="pie" model="#{myBean.myPieChartModel}" />
        </p:panel>

        <p:panel id="panel2" header="Panel 2">
            <p:chart id="myLineChart" type="line"
                model="#{myBean.myLineChartModel1}" />
        </p:panel>

        <p:panel id="panel3" header="panel3">
            <p:chart id="myLineChart2" type="line"
                model="#{myBean.myLineChartModel2}" />
        </p:panel>
    </p:dashboard>
</h:form>

However all the polls I'm using are not just updating the panels which they're associated with, instead they're updating the whole form. How can I fix this?

Any suggestions appriciated.

Upvotes: 0

Views: 2065

Answers (2)

Edylle Landy
Edylle Landy

Reputation: 9

You could test putting prependId=false into the form and update="board:panel1" in your polls. Have you checked if the polls are calling your get method for model component in chart?

Upvotes: -1

Miguel Ruano
Miguel Ruano

Reputation: 61

this works fine but you must change update reference

<p:poll interval="65" update="panel1" listener="#{myBean.updatePanel1}"/>

<p:poll interval="30" update="panel2" listener="#{myBean.updatePanel2}" />

<p:poll interval="45" update="panel3" listener="#{myBean.updatePanel3}" />

if you put :panel1 It refers to the root no from 'myForm'

Upvotes: 0

Related Questions