質問

私のJSFアプリケーションでは、私はアプリケーションフェーズ中にUIコンポーネントを更新する必要があります。それが行うことができますか?ここで私は、これまで生産したコードがあります:

    public void resetDataScroller(ActionEvent actionEvent) {

    final FacesContext ctx = FacesContext.getCurrentInstance();

    ctx.getViewRoot().invokeOnComponent(ctx, "paginator_and_table:scroll_1", new ContextCallback() {
        public void invokeContextCallback(FacesContext facesContext, UIComponent uiComponent) {

            HtmlDatascroller htmlDatascroller = (HtmlDatascroller) uiComponent;

            htmlDatascroller.setPage(1);
            htmlDatascroller.setValue(1);


        }
    });

}

このアクションリスナーは、レンダリングdataScrollerが1よりも別のページを持っているので、まったく機能していないようですdataScrollerコンポーネントとセットのページと生憎1に値を検索します。

私は何かが足りないのですか?

役に立ちましたか?

解決

私は想像しているあなたのresetDataScrollerページ上のコマンドボタン/リンクのactionListener属性によって呼び出されるメソッド?

私は本当にあなたがやろうとしているかを理解していない...あなたはこのコードを記述する必要がありますか? :

public void resetDataScroller(ActionEvent evt) {
    final FacesContext ctx = FacesContext.getCurrentInstance();
    HtmlDatascroller htmlDatascroller = (HtmlDatascroller) ctx.getViewRoot().findComponent("paginator_and_table:scroll_1");
    htmlDatascroller.setPage(1);
    htmlDatascroller.setValue(1);
}
あなたはこの段階HtmlDatascrollerのこれらのプロパティを変更する場合は、

、彼らはあなたのHTMLコードを生成するために最後のフェーズ(Render Response相)中にJSFで使用されます...

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top