component is a repeater and cannot be repainted via ajax directly

蹲街弑〆低调 提交于 2019-12-14 02:10:16

问题


I created List view which contain 2 textboxes
& i want to fill those on ajaxbutton submit.
but I am getting this error:

Component com.cerebrum.pages.ShowCalculator$ShowCalculatorForm$2 has been added to the target. This component is a repeater and cannot be repainted via ajax directly. Instead add its parent or another markup container higher in the hierarchy.


回答1:


You should surround your list view with a WebMarkupContainer and add this markup container to the request target.

html code:

<div wicket:id="wmc">
    ...
    put your list view here
    ...
</div>

java code

final WebMarkupContainer wmc = new WebMarkupContainer("wmc");
add(wmc);
ListView yourListView = ...
// init your list view here
wmc.add(yourListView);

SubmitButton yourButton = new SubmitButton("yourButton") {
    @Override
    public void onSubmit(AjaxRequestTarget target) {
        target.add(wmc);
    }
}
add(yourButton);


来源:https://stackoverflow.com/questions/9663969/component-is-a-repeater-and-cannot-be-repainted-via-ajax-directly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!