Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
1.5.3
-
None
Description
AjaxCheckBox does not support providing an IAjaxCallDecorator the same way AjaxLink does.
Beeing able to provide your own ajax decorator is convenient, if you want to run your own code before or after the ajax call is triggered.
Suggested implementation as in AjaxLink follows:
public abstract class AjaxCheckBox extends CheckBox {
public AjaxCheckBox(final String id)
{ this(id, null); } public AjaxCheckBox(final String id, final IModel<Boolean> model) {
super(id, model);
setOutputMarkupId(true);
add(new AjaxFormComponentUpdatingBehavior("onclick") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target)
@Override
protected IAjaxCallDecorator getAjaxCallDecorator()
});
}
/**
- Returns ajax call decorator that will be used to decorate the ajax call.
* - @return ajax call decorator
*/
protected IAjaxCallDecorator getAjaxCallDecorator() { return null; }
/**
- Listener method invoked on an ajax update call
* - @param target target
*/
protected abstract void onUpdate(AjaxRequestTarget target);
}