Hi Kapil,
The problem is that you display and hide the border at the end of the same request cycle. What you need is to display the border *before* sending the ajax request.
Additionally:
- be careful to deal with correct selector while using jQuery
- wicket-jquery-ui-6.15 is supposed to work with jQuery 1.10.4, (the css reference was 1.10.3 in you quickstart)
So, it can be done like this:
@Override
public void onValueChanged(AjaxRequestTarget target) {
/*
* do save operation here
*/
// border off
String selector = JQueryWidget.getSelector(this);
target.appendJavaScript("border('" + selector + "', false);");
}
@Override
public JQueryBehavior newWidgetBehavior(final String selector)
{
return new DatePickerBehavior(selector, this.options) {
private static final long serialVersionUID = 1L;
@Override
public boolean isOnSelectEventEnabled()
{
return true;
}
@Override
public void onSelect(AjaxRequestTarget target, String date)
{
AjaxDateField.this.onSelect(target, date);
}
@Override
protected JQueryAjaxPostBehavior newOnSelectBehavior()
{
return new OnSelectBehavior(this, AjaxDateField.this) {
private static final long serialVersionUID = 1L;
@Override
public CharSequence getCallbackFunctionBody(CallbackParameter... parameters)
{
// border on
return "border('" + selector + "', true); " + super.getCallbackFunctionBody(parameters);
}
};
}
};
}
Maybe is there a better solution, but that's the one I see for the moment...
Best regards,
Sebastien.