Reputation: 34645
I use wicket and I have created a List Choice like this and overriden onSelectionChanged:
ListChoice<String> hotelList = new ListChoice<String>("hotel",
new PropertyModel<String>(this, "selectedHotel"), hotelLabels) {
@Override
protected void onSelectionChanged(String newSelection)
{
super.onSelectionChanged(newSelection);
System.out.print("Tesy");
}
};
but it did not work - program never fires this method. I do not want use onSubmit to handle this. I need action when someone clicked smth on list.
How to do this in wicket?
Upvotes: 0
Views: 255
Reputation: 2341
final ListChoice<String> hotelList = new ListChoice<String>("hotel", new PropertyModel<String>(this, "selectedHotel"), hotelLabels);
hotelList.add(new AjaxFormComponentUpdatingBehavior("onchange") {
protected void onUpdate(AjaxRequestTarget target) {
System.out.print(hotelList.getModel().getObject());
}
});
hotelList.setOutputMarkupId(true);
Upvotes: 1