0

結果に基づいて @ManagedBean から条件付きでオーバーレイパネルを表示/非表示にするにはどうすればよいですか。
以下のコードでは:p:overlayPanelは forp:commandButtonです。アクションメソッドから条件付きでオーバーレイパネルを表示したい。
現在、コマンドボタンをクリックするたびに表示されています。

<h:form id="form">
    <h:outputLabel value="Town Name:"/>
    <h:inputText value="#{myBean.town}"/>
    <p:commandButton id="checkBtn" value="Check" action="#{myBean.action}"/>

    <p:overlayPanel  widgetVar="overL" id="over" for="checkBtn">
       <h:outputText value="This town is not Listed in our records"/>
    </p:overlayPanel>
</h:form>

** Primefaces 3.5 **を使用しています

4

1 に答える 1

0

オーバーレイ パネルにウィジェット名を付け、showEvent を none に設定します (これにより、デフォルトの動作が強制終了され、JavaScript ハンドルがパネルに割り当てられます)。

widgetVar="myOverlay" showEvent="none"

次のような oncomplete 属性をボタンに追加します。

oncomplete="if(args && !args.validationFailed) myOverlay.show();"
于 2013-10-29T17:53:32.703 に答える