Wicket : capturing onchange event of a drop down

DropDownChoice statusDropDown = new DropDownChoice(“orderStatus”, new  PropertyModel(orderDataProvider,
“statusFilter”), statuses, new ChoiceRenderer() {
private static final long serialVersionUID = 1L;

@Override
public Object getDisplayValue(Object object) {
if (OrderDataProvider.PENDING.equals(object)) {
return getString(“viewExistingOrdersPage.orderTable.column.state.created.label”);
} else {
return getString(“viewExistingOrdersPage.orderTable.column.state.all.label”);
}

}
});

  statusDropDown.add(new AjaxFormSubmitBehavior(“onChange”) {
private static final long serialVersionUID = 1L;

@Override
protected void onSubmit(AjaxRequestTarget target) {
System.out.println(“do your stuff here “);
}

@Override
protected void onError(AjaxRequestTarget target) {

}
});

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s