参见英文答案 >
How to find out client ID of component for ajax update/render? Cannot find component with expression “foo” referenced from “bar”4个
我正在尝试从dataTable中的graphicImage更新一个dataTable.我尝试了很多f:ajax渲染值的组合,但没有成功,现在我使用的是PrimeFaces的p:component函数,但我之前得到了同样的错误.我在浏览器中收到此错误:
@H_404_17@我正在尝试从dataTable中的graphicImage更新一个dataTable.我尝试了很多f:ajax渲染值的组合,但没有成功,现在我使用的是PrimeFaces的p:component函数,但我之前得到了同样的错误.我在浏览器中收到此错误:
f:ajax contains an unknown id ‘j_idt690:painelTabelaAPDespesa’ – cannot locate it in the context of the component j_idt735
我用来刷新的代码:
<f:ajax event="click" render="#{p:component('painelTabelaAPDespesa')}" listener="#{itensAPDespesa.removerItem(item)}" />
你怎么看这个f:ajax在一个数据表内的graphicImage里面.
<h:panelGroup id="painelTabelaAPDespesa"> <p:dataTable id="tabelaAPDespesa" value="#{itensAPDespesa.itens}" var="item"> <p:column> #{itensAPDespesa.itens.indexOf(item)+1} </p:column> <p:column> <f:facet name="header"> <h:outputText value="Número" /> </f:facet> <hrgi:editableText style="width:33%" value="#{item.numeroDocumento}" /> </p:column> <p:column> <f:facet name="header"> <h:outputText value="Vencimento" /> </f:facet> <hrgi:editableDate style="width:33%" value="#{item.dataVencimento}" /> </p:column> <p:column> <f:facet name="header"> <h:outputText value="Valor" /> </f:facet> <hrgi:editableCurrency style="width:33%" value="#{item.valor}"> <f:ajax render="@form" event="blur" listener="#{itensAPDespesa.adicionarItem(item)}" onevent="mudarFocoParaCampoInexistente(this.id)" /> </hrgi:editableCurrency> </p:column> <p:column> <f:facet name="header"> <h:outputText value="Remover" /> </f:facet> <h:graphicImage library="img" name="default_trash.png" style="cursor:pointer;"> <f:ajax event="click" render="#{p:component('painelTabelaAPDespesa')}" listener="#{itensAPDespesa.removerItem(item)}" /> </h:graphicImage> </p:column> </p:dataTable> <h:outputLabel value="Total: #{modeloPopupRegistroDespesa.valorTotal}"> <f:convertNumber type="currency" currencyCode="BRL" currencySymbol="R$" maxFractionDigits="2" minFractionDigits="2" /> </h:outputLabel> </h:panelGroup>
可能这是因为它不知道它在我想要渲染的组件内部,所以如何刷新这个组件(在这种情况下是dataTable的父组件)?