更改侦听器上的 Wicket Select2
Wicket Select2 on change listener
有人知道如何向 Select2 组件添加 onChange 行为。我有这样的 Select2 组件:
Select2Choice select2Choice = new Select2Choice("select2");
有人能告诉我怎么做吗?
您可以监听 JavaScript change
事件:
select2Choice.add(new AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target) {
// select2Choice.getModelObject() gives you the selected choice
// target.add(...); to update some other component
}
});
有人知道如何向 Select2 组件添加 onChange 行为。我有这样的 Select2 组件:
Select2Choice select2Choice = new Select2Choice("select2");
有人能告诉我怎么做吗?
您可以监听 JavaScript change
事件:
select2Choice.add(new AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target) {
// select2Choice.getModelObject() gives you the selected choice
// target.add(...); to update some other component
}
});