{
itemId: 'excel',
text: '导出',
iconCls: 'btnExportExcel',
disabled: false,
handler: function () {
//判断数据状态
if (tempDate.length == 0) {
var alertbox = Ext.widget('messagebox', { shadow: false });
alertbox.show({
title: '提示',
msg: '结果数据为空!请先进行数据统计分析操作!',
buttons: Ext.Msg.OK,
buttonAlign: 'center',
icon: Ext.Msg.WARNING
});
return;
}
//预处理tempDate
var tempD = [];
var buildArr = function (guidspacequery, objtype, layername, pointAlt, wEll) {
this.标识 = guidspacequery;
this.类型 = objtype;
this.所属管类 = layername;
this.点高程 = pointAlt;
this.点类型 = wEll;
}
for (var i = 0; i < tempDate.length; i++) {
var temp = new buildArr(tempDate[i].guidspacequery, tempDate[i].objtype, tempDate[i].layername, tempDate[i].pointAlt, tempDate[i].wEll);
tempD.push(temp);
}
//获取gridpanel数据,json为字符串
var jsonData = Ext.encode(tempD);
var titleData = me.title;
//判断浏览器类型是否为IE
if (Ext.isIE) {
//创建‘frmDummy’
if (!Ext.fly('frmDummy')) {
var frm = document.createElement('form');
frm.id = 'frmDummy';
frm.name = "excelid";
frm.className = 'x-hidden';
document.body.appendChild(frm);
}
//传送数据到后台处理成excel
Ext.Ajax.request({
url: 'NetCode/GridToExcel.ashx',
method: 'POST',
form: Ext.fly('frmDummy'),
callback: function (o, s, r) {
},
isUpload: true,
params: { excelContent: jsonData, excelTitle: titleData }
});
} else {
var alertbox = Ext.widget('messagebox', { shadow: false });
alertbox.show({
title: '提示',
msg: '请使用IE浏览器!',
buttons: Ext.Msg.OK,
buttonAlign: 'center',
icon: Ext.Msg.WARNING
});
return;
}
}
}