日期:2014-05-18 浏览次数:20669 次
items: ['->',{
text: '导出',
handler: function(){
Ext.MessageBox.confirm('提示','确定要导出网点吗?',function(btn){
var requestObj = gridFormPanel.form.getValues();
if (btn == "yes") {
var form = gridFormPanel.form;
var requestObj = gridFormPanel.form.getValues();
form.submit({
waitMsg:"数据处理中,请等待...",
// params:Ext.JSON.encode(requestObj),
url: THREETI.EXPORT_FILE_URL + "sName=/exportSuperItemExcel&&shopCategory=0",
method: 'POST'
}
})
}
}]
String fileName = result.getString("path");
response.reset();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=\""+ fileName + "\"");
ServletOutputStream sos = response.getOutputStream();
// PrintWriter writer = response.getWriter();
BufferedInputStream fin = new BufferedInputStream(new FileInputStream(fileName));
byte[] content = new byte[1024];
int length;
while ((length = fin.read(content, 0, content.length)) != -1) {
sos.write(content, 0, length);
}
fin.close();
sos.flush();
sos.close();
// writeResponse(response, result.toString());