我使用过 wicket、ajax、jquery。在表单上(这有两个日期字段)提交,用户获取文件下载弹出窗口。由于我有微调器来显示处理需要时间,这适用于 ajax 和 jquery。现在的问题是当我使用普通检票口提交按钮时,虽然没有微调器,但报告下载工作正常。但是当我使用 ajaxbutton 时微调器出现,但没有报告打开/保存弹出窗口。
以下代码工作正常并提供打开/保存弹出窗口,但由于没有 ajax 操作,因此不显示微调器
add(new SubmitLink("runReport") {
*//**
*
*//*
private static final long serialVersionUID = 10011L;
*//**
*
*//*
@Override
public void onSubmit() {
HashMap<String, Object> map = new HashMap<String, Object>();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
map.put("reportStartDate", formatter.format(getReportStartDate()));
// Add a day to the end date to include the date entered by the user.
Calendar cal = Calendar.getInstance();
cal.setTime(getReportEndDate());
cal.add(Calendar.DATE, 1);
map.put("reportEndDate", formatter.format(cal.getTime()));
generateReport(map,"ecommerceReport.rptdesign");
}
}
.add(RelativePathPrefixHandler.RELATIVE_PATH_BEHAVIOR)
);
以下代码将微调器显示为其 ajax,但没有打开/保存弹出窗口
AjaxButton runReportButton = new AjaxButton("runReport", this) {
private static final long serialVersionUID = 10008L;
@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
HashMap<String, Object> map = new HashMap<String, Object>();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
map.put("reportStartDate", formatter.format(getReportStartDate()));
// Add a day to the end date to include the date entered by the user.
Calendar cal = Calendar.getInstance();
cal.setTime(getReportEndDate());
cal.add(Calendar.DATE, 1);
map.put("reportEndDate", formatter.format(cal.getTime()));
generateReport(map,"ecommerceReport.rptdesign");
target.addComponent(form);
}
};
runReportButton.add(RelativePathPrefixHandler.RELATIVE_PATH_BEHAVIOR);
runReportButton.add(new SimpleAttributeModifier("onmouseup", "showPopup();"));
add(runReportButton);
即使以下代码也不起作用:
add(new AjaxFallbackButton("runReport", this) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
HashMap<String, Object> map = new HashMap<String, Object>();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
map.put("reportStartDate", formatter.format(getReportStartDate()));
// Add a day to the end date to include the date entered by the user.
Calendar cal = Calendar.getInstance();
cal.setTime(getReportEndDate());
cal.add(Calendar.DATE, 1);
map.put("reportEndDate", formatter.format(cal.getTime()));
generateReport(map,"ecommerceReport.rptdesign");
target.addComponent(form);
}
});
任何帮助,我做错了什么