【问题标题】:using p:dialog in ui:composition在 ui:composition 中使用 p:dialog
【发布时间】:2014-08-24 04:56:13
【问题描述】:

我有一个页面inner.xhtml 使用ui:include 包含在outer.xhtml 中。 inner.xhtml 有一个 p:commandLink,其 oncomplete 属性会打开一个 p:dialog。

inner.xhtml

<html>
 <ui:composition>
  <h:form>
   <p:commandLink oncomplete="mydialog.show();" actionListener="listener method" process="@this">
   </p:commandLink>
  </h:form>
 </ui:composition>
 <p:dialog id="mydialogid" widgetVar="mydialog">
   My Code For Dialog
 </p:dialog>
</html>

outer.xhtml

<h:form>
<p:commandButton oncomplete="dlg.show();" actionListener="listener method" global="false"></p:commandButton>
</h:form>
<p:dialog id="dlgid" widgetVar="dlg" dynamic="true" appendTo="@(body)">
    <ui:include src="inner.xhtml">
        <ui:param name="idPrefix" value="par"/>
    </ui:include>
</p:dialog>

问题是单击inner.xhtml 中的commandlink 时出现此错误

Uncaught ReferenceError: mydialog is not defined

而且对话框没有打开。如何解决这个问题?

我正在使用 primefaces 4.0

【问题讨论】:

    标签: jsf-2 primefaces


    【解决方案1】:

    查看 PrimeFaces 文档。

    你需要做的:-

    <p:commandButton oncomplete="PF('mydialog').show();">
    

    我目前遇到oncomplete 的问题,所以如果这不起作用,请尝试排除此问题:-

    <p:commandButton onclick="PF('mydialog').show();">
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-21
      • 2013-06-28
      相关资源
      最近更新 更多