Primefaces DataTable Ajax不更新除自身以外的任何组件 [英] Primefaces DataTable ajax not updating any component except itself
问题描述
<h:form id="form">
<p:messages />
<p:panel header="Análise">
<h:outputText value="Mês da análise: " />
<p:selectOneMenu value="#{report005.selectedMes}">
<f:selectItems var="data" value="#{report005.analiseMeses}" itemLabel="#{report005.formataDataCombo(data)}" />
<f:convertDateTime pattern="MM/yyyy" />
</p:selectOneMenu>
<p:commandButton value="Análises" update="analiseTable" actionListener="#{report005.loadAnalise()}" />
<p:dataTable id="analiseTable" var="pes" value="#{report005.analiseModel}" selection="#{report005.selectedAnalise}" emptyMessage="Não há registros...">
<p:column selectionMode="multiple" style="width:18px" />
<p:ajax event="rowSelectCheckbox" listener="#{report005.loadAnaliseProduto()}" update="produtosmanycheck" />
<p:column headerText="Código">
#{pes.cod_analise}
</p:column>
<p:column headerText="Nome">
#{pes.dsc_analise}
</p:column>
<p:column headerText="Descrição">
#{pes.dsc_resumida_acao}
</p:column>
<p:column headerText="Planejamento">
<h:outputText value="#{pes.dat_planejamento_analise}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>
</p:column>
</p:dataTable>
</p:panel>
<p:panel header="Produto Gerencial">
<p:selectManyCheckbox id="produtosmanycheck" value="#{report005.selectedProduto}" layout="pageDirection">
<f:selectItems id="teste" value="#{report005.produtos}" />
</p:selectManyCheckbox>
</p:panel>
<p:commandButton value="Enviar" action="#{report005.send}" ajax="false" />
</h:form>
当AJAX事件"rowSelectCheckbox"被触发时,它找不到要更新的"produtosmanycheck"组件,因此向我返回了以下错误:
Whan the AJAX event "rowSelectCheckbox" is fired, it does not find the 'produtosmanycheck' component to update, returning the following error to me:
javax.faces.FacesException:找不到带有标识符的组件 从"form:analiseTable"引用的"produtosmanycheck".在 org.primefaces.util.ComponentUtils.findClientIds(ComponentUtils.java:251) 在 org.primefaces.util.AjaxRequestBuilder.addIds(AjaxRequestBuilder.java:102) 在 org.primefaces.util.AjaxRequestBuilder.update(AjaxRequestBuilder.java:90)
javax.faces.FacesException: Cannot find component with identifier "produtosmanycheck" referenced from "form:analiseTable". at org.primefaces.util.ComponentUtils.findClientIds(ComponentUtils.java:251) at org.primefaces.util.AjaxRequestBuilder.addIds(AjaxRequestBuilder.java:102) at org.primefaces.util.AjaxRequestBuilder.update(AjaxRequestBuilder.java:90)
我已经尝试过=:form:produtosmanycheck,form:produtosmanycheck,:produtosmanycheck,produtosmanycheck
I already tried= :form:produtosmanycheck, form:produtosmanycheck, :produtosmanycheck, produtosmanycheck
我也尝试删除FORM ID ...没有成功...
I tried removing the FORM id too... without success...
我做错了什么?除了DataTable,我无法更新任何组件.
What am I doing wrong? I can't update any component but the DataTable...
推荐答案
您是否尝试将ID"produtosmanycheck"放在父级p:panel元素上,而不是放在p:selectManyCheckbox本身上?
Have you tried putting the id "produtosmanycheck" on the parent p:panel element instead of on the p:selectManyCheckbox itself?
即使前缀ID为false,也绝不能在JSF中完成表单嵌套,因为这会导致意外或无行为.
Form nesting should never be done in JSF even with prepend ID false as it will cause unexpected or no behaviour.
这篇关于Primefaces DataTable Ajax不更新除自身以外的任何组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!