【发布时间】:2017-11-10 09:14:47
【问题描述】:
我在 apache-wicket-7 中有一个带有 RadioGroup 的页面。我想用 ajax 在后端 Page 类中调用一个方法。为此,我添加:
AjaxFormChoiceComponentUpdatingBehavior
代码:
this.listInput = new RadioGroup<T>("radioGroup", this.model);
this.listInput.add(new AjaxFormChoiceComponentUpdatingBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget arg0) {
System.out.println("The selected value is " + getComponent().getDefaultModelObjectAsString());
}
});
组件 RadioGroup 在较早的 ajax 调用后变得可见,因此它也是异步呈现的。但是当wicket尝试渲染组件时,会出现错误信息:
Wicket.Ajax: Cannot bind a listener for event "click" on element "radioGroup1d" because the element is not in the DOM
添加:
setOutputMarkupPlaceholderTag(true)
什么都不做。 如何解决这个问题?
问候, 马特乌斯
【问题讨论】:
标签: java wicket radio-group