我是一个wicket的新手,我正在尝试一些事情,比如,我有四个面板但只有一个应该根据DropdownChoice组件中的选择添加.我尝试使用onSelectChange()方法添加面板,但它不起作用.任何人都可以帮我解决正确的示例代码.
我举个例子来说明这个问题.希望能帮助到你.
DropDownChoice dropDown = new DropDownChoice(...........);
AjaxFormComponentUpdatingBehavior behavior = new AjaxFormComponentUpdatingBehavior(
"onchange") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
//you should write here the logic that
// replaces the panel, something like: content.addOrReplace(panel)
target.addComponent(form);
}
};
dropDown.add(behavior);
Run Code Online (Sandbox Code Playgroud)
这就是全部,您必须使用AjaxFormComponentUpdatingBehavior来处理onchange事件.如果下拉菜单不是必需项,则可以使用tabbedpanel.在这里您可以找到示例代码:wicket选项卡式面板
| 归档时间: |
|
| 查看次数: |
1695 次 |
| 最近记录: |