user1263633
user1263633

Reputation: 289

component is a repeater and cannot be repainted via ajax directly

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.

Upvotes: 3

Views: 2401

Answers (1)

magomi
magomi

Reputation: 6685

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);

Upvotes: 13

Related Questions