【发布时间】:2021-07-06 11:04:02
【问题描述】:
从外部对话框保存后,我会尝试从rowExpansion 更新一行,而不将整个表单更新为不关闭。
我只想从 rowExpansion 的dataTable 更新我刚刚编辑的子行。
idCommandButtonDetailProductChild 按钮调用idDialogDetailProduct 对话框,用于编辑数据。在此对话框中,使用 idCommandButtonUpdate 按钮保存时,我希望在不关闭 rowExpansion 的情况下更新 idTableDetailProductChild 的行。
我的代码如下:
ProductsList.xhtml(带有rowExpansion的数据表)
<!-- PRODUCT LIST -->
<p:dataTable id="idTableDetailProduct"
paginator="false"
value="#{productController.productDetailDTOs}"
var="productDetail"
selection="#{productController.selectedProductDTOs}"
rowKey="#{productDetail.id}"
emptyMessage="#{diccBean.msg['product.productNotFound']]}"
scrollable="true"
scrollHeight="600">
...
<p:rowExpansion>
<!-- PRODUCT LIST CHILD -->
<p:dataTable id="idTableDetailProductChild"
paginator="false"
value="#{productDetail.productDTO.listProductsChild}"
var="productChild"
rowKey="#{productDetail.id}"
emptyMessage="#{diccBean.msg['product.productChildNotFound']}"
scrollable="true">
<!-- VIEW PRODUCT DETAIL -->
<p:commandButton
id="idCommandButtonDetailProductChild"
title="#{diccBean.msg['product.detailProduct']}"
icon="fa fa-fw fa-search"
action="#{productController.initDetailProduct}"
oncomplete="PF('widgetVarDetailProduct').show();"
update="tabViewDetalle:idDialogDetailProduct">
<f:setPropertyActionListener value="#{productChild.productDetailDTO.id}" target="#{productController.productDetailId}"/>
</p:commandButton>
ProductDialog.xhtml(我从这里更新 rowExpansion 的子行)
<h:body>
<ui:composition>
<p:dialog id="idDialogDetailProduct"
header="#{diccBean.msg['product.tittleDetailProduct']]}"
resizable="false"
widgetVar="widgetVarDetailProduct"
modal="true"
width="1200"
appendTo="@(body)"
binding="#{productController.idDialogDetailProduct}">
<h:form id="formDetailProduct">
...
<!-- SAVE COMPONENT BUTTON -->
<p:commandButton
id="idCommandButtonUpdate"
value="Componente: #{diccBean.msg['actions.save']}"
action="#{productController.actionUpdate}"
process="@form"
icon="fa fa-fw fa-check"
update="tabViewDetalle:idTableDetailProduct" />
</h:form>
</p:dialog>
</ui:composition>
</h:body>
【问题讨论】:
标签: java jsf primefaces