我是wicket的新手,我对模态窗口有疑问。我试图做的是,当我点击页面上的按钮从列表中删除用户时,模态窗口显示询问我是否确定要删除用户,点击确认按钮后用户从列表中删除并且窗口关闭,但是如果删除操作失败(某些例外),应该出现第二个模态窗口,通知我抛出了什么异常,并且第一个窗口应该自动关闭(或者在第二个窗口单击继续按钮后应该关闭它们)。我的问题是第一个窗口只有在点击取消按钮后才关闭,我不知道如何解决它。我的代码看起来像:
doRemoveAction(account, target){
selectModalWindow.show(target)
}
SelectModalWindow deleteConfirmWindow = new SelectModalWindow("modal", title, message){
void onConfirm(AjaxRequestTarget target){
try{
remove(account);close(target);
}catch(Exception e){
infoModalWarning.show(target);
}
void onCancle(AjaxRequestTarget target){
close(target);
}
private InfoModalWindow infoModalWindow = new InfoModalWindow(
"infomodalwindow", title) {
public void submit(AjaxRequestTarget target) {
close(target);
}
};
doRemoveAction(account, target){
selectModalWindow.show(target)
}
SelectModalWindow deleteConfirmWindow = new SelectModalWindow("modal", title, message){
void onConfirm(AjaxRequestTarget target){
try{
remove(account);close(target);
}catch(Exception e){
infoModalWarning.show(target);
}
void onCancle(AjaxRequestTarget target){
close(target);
}
private InfoModalWindow infoModalWindow = new InfoModalWindow(
"infomodalwindow", title) {
public void submit(AjaxRequestTarget target) {
close(target);
}
};
我希望自己清楚明白,谢谢你的帮助。