1

プログレス バーが完了した後でコマンド ボタンを有効にしようとしていますが、ページを読み込むと、コマンド ボタンは既に有効になっていますが、それ以外は正常に動作します。

私はいくつかの調査と同様の問題 を行いました。最初にdisable="true"のときにcommandButtonが機能 しないしかし、解決策はうまくいきませんでした。

私が間違っていることは何ですか?足りないものはありますか?

これはindex.xhtmlです

            <p:growl id="growl" />
            <h3>Deskarga</h3>
            <p:messages id="messages" showDetail="true" autoUpdate="true"
                closable="true" />
            <p:commandButton value="Start" type="button"
                onclick="pbAjax.start();startButton2.disable();"
                widgetVar="startButton2" />
            <p:commandButton value="Cancel"
                actionListener="#{progressBean.cancel}"
                oncomplete="pbAjax.cancel();startButton2.enable();" />

            <p:progressBar widgetVar="pbAjax" ajax="true" rendered="true"
                value="#{progressBean.progress}" labelTemplate="{value}%"
                styleClass="animated" interval="250">
                <p:ajax event="complete" listener="#{progressBean.onComplete}"
                    update="messages"
                    oncomplete="startButton2.enable();#{progressBean.setDisabled(false)};"/>
            </p:progressBar>


            <p:separator id="separator2" />

            <p:commandButton value="Parseatu" widgetVar="parserButton" ajax="true"
                disabled="#{progressBean.disabled}" actionListener="#{progressBean.parseatu()}"
                update="growl" />

        </h:form>

そして、これはセッション スコープのマネージド Bean です。

public class ProgressBean implements Serializable {  

    private boolean disabled= true;



    public boolean isDisabled() {
        return disabled;
    }

    public void setDisabled(boolean disabled) {
        this.disabled= disabled;
    }

}  
4

1 に答える 1

0

まず、oncomplete 属性でメソッドを bean することはできません。これはうまくいかないはずです

oncomplete="startButton2.enable();#{progressBean.setDisabled(false)};"

oncomplete 属性を使用して ProgressBar コンポーネントを無効にする場合は、javascript 関数を呼び出す必要があります。これには、RemoteCommandを使用するか、少なくともリスナー メソッドの無効な属性を更新することができます

第二に。

ページをロードすると、コマンドボタンは既に有効になっていますが、これを除けば正常に動作します。

CommandButton コンポーネントには、デフォルトdisabledの in 属性がfalseあります。表示を無効にしたい場合は、属性disabledを入れてくださいtrue

于 2013-05-26T21:15:48.573 に答える