Jquery Ui Widget dialog with wicket

Jquery Ui Widget dialog with wicket

Hi,


I am using wicket message dialog box, which is a jquery ui widget dialog.

I want to close the dialog box , when user clicks on "confirm
 button. Even if the operation takes time, the dialog box must close.

When I press "Cancel" dialog box closes immedialtely, but when I click "confirm", and the operation takes longer , then the dialog box is still open. I don't want this behanvior,

I am doing something like this:

final MessageDialogAjaxBehavior confirmDialog = new MessageDialogAjaxBehavior("confirmDialog", Model.of("Warning"), message, DialogButtons.YES_NO, DialogIcon.WARN) {


 @Override
public void onClose(AjaxRequestTarget target, DialogButton button) {
 String js2 = this.getMarkupId() + ".dialog('close')";            


target.appendJavaScript(js2);
        

if (button != null && "YES".equalsIgnoreCase(button.toString()))

labTestTypeService.delete(labTestTemplateType.getState(), EnoviaId.create)

target.add(container);
}

}

};



But , this doesn't close the dialog box, til opertation is complete.

Kindly help