最近项目中使用了Exts框架,在页面操作过程中有时需要平滑的时间滚动条,可以通过下面的方式来实现:点击按钮操作的时候,发一个Ajax请求,把数据整理好放入Session中,然后再发一个Ajax请求,把Session中的数据导出为Excel文件,代码如下:
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
ext messageBoxExt.MessageBox.wait('操作中,请稍后……','温馨提示');
Ext.Ajax.request({//发送请求传输SAP
url: 'RcPingGuInfoMainAction.do?method=writeSap',
waitMessage:'传输中......',
params:{jidu: year, depart:sDpart,
kaoheren: kaoheren, band:band,
startFenshu:startFenshu,endFenshu:endFenshu,
btrortrm:btrTrm,type:'<%=flag%>'},
success: function(response,opts) {
Ext.MessageBox.hide();
var result = Ext.util.JSON.decode(response.responseText);
if (result.flag == '1') {
Ext.MessageBox.show({
title : msgTitle,
msg : '部分数据回写SAP出现错误,是否导出错误数据?',
buttons : Ext.Msg.OKCANCEL,
animEl : '_content',
fn : function(e){
if(e == 'ok'){//刷新列表
window.location.href='<%=path %>/RcPingGuInfoMainAction.do?method=outExcel&result=true';
}else{
Ext.Ajax.request({
url: 'RcPingGuInfoMainAction.do?method=outExcel&result=false', //回写KPI总分
success: function(response,opts) {},
failure: function(response,opts) {}
});
}
},
width : 500,
icon : Ext.MessageBox.WARNING,
closable: false
});
} else if (result.flag == '2') {
comError(messageTishiLan,"传输SAP正常结束!");
} else if (result.flag == '3') {
comError(messageTishiLan,"传输失败,请重新传输或同管理员联系!");
} else {
comError(messageTishiLan,"该季度没有TRM考评信息,请确认!");
}
},
failure: function(response,opts) {
/*Ext.MessageBox.show({
title : msgTitle,
msg : '传输失败,请重新传输或同管理员联系!',
buttons : Ext.Msg.OK,
animEl : '_content',
fn : function(e){
if(e == 'ok'){
}
},
width : 500,
icon : Ext.MessageBox.WARNING,
closable: false
});*/
comError(messageTishiLan,"传输失败,请重新传输或同管理员联系!");
},
timeout: 30000000
})