[英]update from dialog to component primefaces
How do I update the <p:dataTable id="dtCarg">
from the command button in the <p:dialog>
? 如何从
<p:dialog>
的命令按钮更新<p:dataTable id="dtCarg">
<p:dialog>
?
I keep getting the following error: 我不断收到以下错误:
Cannot find component with identifier "dtCarg" referenced from "table_servidoresxdependencia"
找不到从“ table_servidoresxdependencia”引用的标识符为“ dtCarg”的组件
The code is: 代码是:
<h:form id="formGestionServidores" prependId="false" style="font-size:10px;">
<p:panel>
<table id="tabla_objetivo_02">
<tr>
<td><p:fieldset id="tb_tabla_new" legend="Servidores" styleClass="ui-state-hover"
style="min-width:98%;height:100% ">
<p:dataTable id="dtCarg" var="cargo" value="#{mantePlazasController.listCargos}"
rowStyleClass="#{cargo.colorEstado}" emptyMessage="No existen plazas para la unidad seleccionada"
editable="true" style="font-weight: normal;overflow:auto;min-width:98%;">
<p:column headerText="Unidad">
<h:outputText value="#{cargo.serDescDep}"
rendered="#{mantePlazasController.nivel!=2 and mantePlazasController.nivel!=3 and mantePlazasController.nivel!=4 and mantePlazasController.nivel!=5 and mantePlazasController.nivel!=6 and mantePlazasController.nivel!=7}" />
<h:outputText value="#{cargo.serDescDepNVL3}"
rendered="#{mantePlazasController.nivel==2 or mantePlazasController.nivel==3 or mantePlazasController.nivel==4 or mantePlazasController.nivel==5 or mantePlazasController.nivel==6 or mantePlazasController.nivel==7}" />
</p:column>
<p:column headerText="Historial">
<center>
<p:commandButton id="btnHistorial" icon="ui-icon-note" oncomplete="dlRegularizar.show()"
title="Historial de Plaza" action="#{mantePlazasController.mostrarHistorial}">
<f:setPropertyActionListener value="#{cargo}" target="#{mantePlazasController.cargoSelected}" />
</p:commandButton>
falta oncomplete falta actualizar
</center>
</p:column>
</p:dataTable>
</p:fieldset></td>
</tr>
</table>
<p:dialog widgetVar="dlRegularizar" header="Regularizar Servidores" width="1210" modal="true">
<p:dataTable id="table_servidoresxdependencia" var="servidorxdependencia"
value="#{mantePlazasController.servidoresxdependencia}"
emptyMessage="No existen trabajadores en el historial, para esa plaza"
rowStyleClass="#{servidorxdependencia.color_his}">
<p:ajax event="rowEdit" listener="#{mantePlazasController.onEditRowServidorxDependencia}"
update="tabla_objetivo_02:dtCarg,table_servidoresxdependencia,notificacionCalificacion,my_json_data" />
<f:facet name="header">
Servidor-Dependencia HISTORIAL
</f:facet>
<p:column headerText="Codigo">
<h:outputText value="#{servidorxdependencia.serCod}" />
</p:column>
<p:column headerText="Fecha de inicio">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{servidorxdependencia.serFech_in_unmsm_str}" />
</f:facet>
<f:facet name="input">
<p:calendar value="#{servidorxdependencia.serFech_in_unmsm}" navigator="true" inputStyle="width:70px"
locale="es" pattern="dd/MM/yyyy" showButtonPanel="true" readOnlyInputText="true" showOn="button">
</p:calendar>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Edit" style="width:20px">
<p:rowEditor />
</p:column>
<p:column headerText="Elim">
<center>
<p:commandButton id="HisEliSer" icon="ui-icon-trash" oncomplete="puenteEliSerHis(),linea_ocultar()"
title="Eliminar">
<f:setPropertyActionListener value="#{servidorxdependencia}" target="#{mantePlazasController.servidorHisElim}" />
</p:commandButton>
</center>
</p:column>
</p:dataTable>
</p:dialog>
</p:panel>
</h:form>
So, basically, you have a 所以,基本上,你有一个
<h:form id="formGestionServidores" prependId="false" ...>
<p:panel>
<table id="tabla_objetivo_02">
<tr>
<td>
<p:fieldset id="tb_tabla_new" ...>
<p:dataTable id="dtCarg" ...>
and you want to reference it in the update as follows 并且您想要在更新中引用它,如下所示
<p:ajax ... update="tabla_objetivo_02:dtCarg" />
This is indeed not going to work. 这确实是行不通的。 The HTML
<table>
element does not represent a JSF component, so it is not available in the JSF component tree. HTML
<table>
元素不代表JSF组件,因此在JSF组件树中不可用。 For starters, the easiest way to find out the right client ID is to look in the generated HTML output by rightclick and View Source in browser. 对于初学者来说,找出正确的客户端ID的最简单方法是通过右键单击并在浏览器中查看源代码来查看生成的HTML输出。 Locate the HTML representation of
<p:dataTable id="dtCarg">
and use exactly its id
attribute in the update, prefixed with :
. 找到
<p:dataTable id="dtCarg">
的HTML表示形式,并在更新中完全使用其id
属性(以:
<p:dataTable id="dtCarg">
。
Based on the view markup posted so far, with <h:form prependId="false">
, the generated HTML representation should just have id="dtCarg"
, so you should reference it as follows: 基于到目前为止发布的视图标记(使用
<h:form prependId="false">
,生成的HTML表示应仅具有id="dtCarg"
,因此您应按以下方式引用它:
<p:ajax ... update=":dtCarg" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.