gpt4 book ai didi

jsf - 如何关闭 p :dialog after a p:commandButton action?

转载 作者:行者123 更新时间:2023-12-04 19:48:37 27 4
gpt4 key购买 nike

我有一个 p:dialog显示在 p:dataTable 之后单击行。我有一个 p:commandButtonp:dialog它有一个 action像这样:

<p:commandButton value="Cambiar" action="#{adminUsuarios.cambiarPerfil()}" update="tblUsuarios" />

方法 cambiarPerfil() :
public void cambiarPerfil() {
// More stuff here
this.listaUsuarios = null; // Clear the list
}

这工作正常,但 我要关闭 p:dialogp:commandButton action .

这是对话框:
<h:form id="myForm">
<!-- More stuff-->
<p:dialog id="myDialog" widgetVar="editarDialog" header="Editar perfil de usuario #{adminUsuarios.usuarioSeleccionado.id_User}" resizable="false" width="400" showEffect="size" hideEffect="size">
<p:commandButton value="Cambiar" action="#{adminUsuarios.cambiarPerfil()}" update="tblUsuarios" />
</p:dialog>
</h:form>

最佳答案

您需要添加一个 oncomplete您的 commandButton 中的客户端方法.

<h:form id="myForm">
...
<p:dialog id="myDialog" widgetVar="editarDialog" ...>
<p:commandButton value="Cambiar" action="#{adminUsuarios.cambiarPerfil()}" update="tblUsuarios" oncomplete="editarDialog.hide();"/>
</p:dialog>
</h:form>

如果您使用的是 PF5.0,您可能需要将其更改为 oncomplete="PF('editarDialog').hide();"其中 editarDialog 是您的对话框的 widgetVar .

关于jsf - 如何关闭 p :dialog after a p:commandButton action?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24768892/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com