You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by 蔡茂昌 <ca...@gmail.com> on 2010/06/17 09:20:51 UTC
modalWindow can't be closed
hi, i have a problem , i have a modalWindow, there is a button in the
modalWindow,when i click the button ,i want the modalWindow be closed ,but
now it can not be be closed , below is my code ,
AjaxButton saveBtn = new AjaxButton("save") {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
List<People> list3 =
peopleService.fetchBySearchCondition(searchCondition);
List<PeopleForExport> resultList = doTransLate(list3);
File file = peopleService.exportExcelFile(resultList,formModel);
IResourceStream is = new FileResourceStream(file);
try {
if (((WebRequest) getRequest()).getHttpServletRequest()
.getHeader("User-Agent").toLowerCase().indexOf(
"firefox") > 0) {
getRequestCycle()
.setRequestTarget(
new ResourceStreamRequestTarget(is)
.setFileName(new String(file
.getName().getBytes(
"UTF-8"),
"ISO8859_1")));
} else {
getRequestCycle().setRequestTarget(
new ResourceStreamRequestTarget(is)
.setFileName(URLEncoder.encode(
file.getName(), "UTF-8")
.replace("+", "%20")));
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
getRequestCycle().setRequestTarget(null);
modalWindow.close(target);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
target.addComponent(feedbackPanel);
}
};
form.add(saveBtn);
thanks
--jans