Saturday, 15 August 2015

jsf - Primefaces : <p:ajax inside of DataTable calls method several times after I update the dataTable -



jsf - Primefaces : <p:ajax inside of DataTable calls method several times after I update the dataTable -

the problem "p:ajax event="rowdblselect" listener="#{companybean.update()}" ... ", when doubleclick first time, method "update()" called 1 time (perfect !), after when press on commandbutton "button1" , doubleclick on component 1 time again , "update()" called 2 times. when repeat 1 more time, "update()" called 3 times ... ... ... ... weird !! think when update datatable commandbutton, ajax event keeps upgrade itself. dont know (?) ... help me solve ??

<h:panelgrid id="panel" columns="5"> <p:commandbutton id="button1" value="search" actionlistener="#{ companybean.search()}" update="datatable"/> </h:panelgrid>

<p:datatable id="datatable" var="companyto" value="#{companybean.companiesto}" selection="#companybean.selectedcompanyto}" rowkey="#{companyto}" emptymessage="" selectionmode="single" > <p:ajax event="rowdblselect" listener="#{companybean.update()}" immediate="true" process="@this" /> <p:column > ... <p:datatable>

obs.: when remove "update="datatable", "event="rowdblselect"" works perfect, phone call method 1 time. so, problem on update.

i found same problem here : updating datatable own datamodel calls method more , more

try remove immediate attribute of ajax event , in commandbutton add together attributes:

process="@this" partialsubmit="true" ajax="true"

somethig this:

event:

<p:ajax event="rowdblselect" listener="#{companybean.update()}" process="@this" partialsubmit="true" />

button:

<p:commandbutton id="button1" value="search" actionlistener="#{ companybean.search()}" update="datatable" process="@this" partialsubmit="true" ajax="true"/>

jsf primefaces datatable

No comments:

Post a Comment