问题出在" p:ajax event =" rowDblselect"听者="#{companyBean.update()}" ...",当我第一次双击时,方法"更新()"被称为一次(完美!),但之后我按下commandButton" button1"然后我再次双击组件,"更新()"被称为2次。当我再重复一次时,"更新()"被称为3次...... ...... 这很奇怪!!我想当我使用commandButton更新数据表时,ajax事件会保持自身的升级。我不知道(?)......有人能帮我解决吗?
<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。:当我删除&#34; update =&#34; dataTable&#34;时,&#34; event =&#34; rowDblselect&#34;&#34;工作完美,只召唤一次方法。所以,问题在于更新。
我在这里发现了同样的问题:https://stackoverflow.com/questions/11904556/updating-datatable-with-own-datamodel-calls-method-more-and-more
答案 0 :(得分:1)
尝试删除immediate
事件的ajax
属性,并在commandbutton
中添加属性:
process="@this" partialSubmit="true" ajax="true"
Somethig喜欢这样:
事件:
<p:ajax event="rowDblselect" listener="#{companyBean.update()}" process="@this" partialSubmit="true" />
按钮:
<p:commandButton id="button1" value="Search" actionListener="#{
companyBean.search()}" update="dataTable" process="@this" partialSubmit="true" ajax="true"/>