0

私が使用modal= trueappendToBody=trueているダイアログでは、ChromeとFirefoxで正常に動作しますが、IE8では動作しません。ダイアログが表示されますが、ダイアログを閉じると、が原因で背景がまだ青色のままですがmodal=true、これを使用する必要があります。

これは私のコードです:

  <ui:composition template="../templates/site.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:sec="http://www.springframework.org/security/tags">

    <ui:define name="content">

        <h:form id="form">

            <p:commandButton value="Button" type="button" id="myButton"
                onclick="form:testDialog.show()" />



        <p:dialog id="testDialog" widgetVar="testDialog"
            header="My Test Dialog" modal="true" appendToBody="true">
            <h:form>

                <p:fieldset legend="Dialog">
                    <p:spacer height="30" />


                </p:fieldset>
            </h:form>
        </p:dialog>
        </h:form>
    </ui:define>
</ui:composition>

編集:

問題はダイアログの命名でした。IDとwidgetVarに同じ名前を付けることはできません。この投稿に関連する

4

2 に答える 2

3

<p:layout>テンプレートファイルで使用していますか?

レイアウトとモーダル ダイアログを混在させると、常に問題が発生します。

私の親テンプレートでは、通常、以下を使用してモーダル ダイアログを配置するスペースを定義します<ui:insert>

mainTemplate:xhtml:

<h:body>
    <p:layout>
        <p:layoutUnit position="cemter">
            <ui:insert name="content"/>
        </p:layoutUnit>
    <p:layout>

    <ui:insert name="dialogs"/>
</h:body>

someXhtml.xhtml

<ui:composition template="mainTemplate.xhtml">
    <ui:define name="content">
        bla bla bla
    </ui:define>

    <ui:define name="dialogs">
        <p:dialog modal="true" appendToBody="false">
            ....
        </p:dialog>
    </ui:define>
</ui:composition>

それを使用して、フォームを本文に「手動で追加」しているため、本文への追加をtrueに設定する必要はありません。これにより、任意の xhtml ページにフォームを挿入でき、レイアウトのモーダル フォームについて心配する必要がなくなります。

于 2013-02-05T10:05:35.053 に答える
1

ここにネストされたフォームがありますが、これは HTML では許可されていません。ボタンの直後、ダイアログの前に最初の会社を閉じるようにしてください。

<h:form id="form">
  <p:commandButton value="Button" type="button" id="myButton"
      onclick="testDialog.show()"/>
</h:form>

<p:dialog id="testDialog" widgetVar="testDialog"
    header="My Test Dialog" modal="true" appendToBody="true">
  <h:form>
    <p:fieldset legend="Dialog">
      <p:spacer height="30" />
    </p:fieldset>
  </h:form>
</p:dialog>

私も に変更form:testDialog.show()しましたがtestDialog.show()、あなたの処方はうまくいかないようです。

于 2013-02-05T09:52:45.573 に答える