有谁知道,如何在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
}
});