Reputation: 435
do someone know, how to add onChange behaiviour to Select2 component. I have Select2 component like this :
Select2Choice select2Choice = new Select2Choice("select2");
Can someone give me a point how to do this?
Upvotes: 0
Views: 273
Reputation: 17533
You can listen for JavaScript change
event:
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
}
});
Upvotes: 1