【问题标题】:PrimeFaces CommandButton is not working in DialogPrimeFaces CommandButton 在对话框中不起作用
【发布时间】:2015-05-07 13:43:44
【问题描述】:

我需要您的帮助来解决对话框中 CommandButton 的问题,因为我在操作中调用了一个名为 UpdatePrint() 的方法,但它没有被调用。 jsf页面代码如下:

<h:form id="Requests">
.
.
.
<p:commandButton update=":Requests:#{hr.dialogueName}" oncomplete="PF('#{hr.certificateDialogue}').show()" icon="ui-icon-search" title="View">
<f:setPropertyActionListener value="#{hr}" target="#{hrd.selectedRequest}"/>
</p:commandButton>
.
.
<p:dialog header="cert1" widgetVar="cert1" modal="true" showEffect="fade" hideEffect="fade" resizable="true">
<p:outputPanel id="HRCEEN" style="text-align:center;">
</p:outputPanel>
 <p:commandButton value="Print" action="#{hrd.UpdatePrint}" type="button" icon="ui-icon-print"  style="display:block;margin-bottom: 20px">
<p:printer target="HRCEEN"/>
</p:commandButton>
</p:dialog>
.
.

<p:dialog header="cert2" widgetVar="cert2" modal="true" showEffect="fade" hideEffect="fade" resizable="true">
<p:outputPanel id="HRSSEN" style="text-align:center;">
</p:outputPanel>
<p:commandButton value="Print" action="#{hrd.UpdatePrint}" type="button" icon="ui-icon-print"  style="display:block;margin-bottom: 20px">
<p:printer target="HRSSEN"/>
</p:commandButton>
</p:dialog>

</h:form>

我尝试了不同的方法,但没有成功,因为它表明当我在更新中引用时找不到更新中的部分。

 <p:commandButton update=":Requests:#{hr.dialogueName}" oncomplete="PF('#{hr.certificateDialogue}').show()" icon="ui-icon-search" title="View">
<f:setPropertyActionListener value="#{hr}" target="#{hrd.selectedRequest}"/>
</p:commandButton>

【问题讨论】:

    标签: primefaces dialog commandbutton


    【解决方案1】:

    由于type="button" 属性,没有调用操作方法 - 没有提交到服务器。删除type,则触发动作(按钮默认为submit类型)。

    【讨论】:

    • 这适用于任何带有type="button" 的命令按钮,而不是专门在对话框中
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-09-10
    • 1970-01-01
    • 2023-04-01
    • 2013-12-31
    • 2015-03-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多