组件是转发器,不能直接通过ajax进行重绘 [英] component is a repeater and cannot be repainted via ajax directly
问题描述
我创建了包含2个文本框的列表视图
&我想将其填充在ajaxbutton提交上.
但我收到此错误:
I created List view which contain 2 textboxes
& i want to fill those on ajaxbutton submit.
but I am getting this error:
组件com.cerebrum.pages.ShowCalculator $ ShowCalculatorForm $ 2具有 已添加到目标.此组件是转发器,不能为 通过ajax直接重绘.而是添加其父项或其他项 标记容器位于层次结构中较高的位置.
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.
推荐答案
您应该使用WebMarkupContainer包围列表视图,并将此标记容器添加到请求目标.
You should surround your list view with a WebMarkupContainer and add this markup container to the request target.
html代码:
<div wicket:id="wmc">
...
put your list view here
...
</div>
java代码
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);
这篇关于组件是转发器,不能直接通过ajax进行重绘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!