我正在将项目更新到Handson Table的新版本。
这用于运行MySQL,JSP和Apache Tomcat 64的Windows Server。
function exportXls(data,gridid,current_sheet_name) {
if(current_table=="reports") {
var servicePath = service_path+"/getrmsfilename";
showMessage("Exporting Data..<div class='mdl-spinner mdl-js-spinner is-active'></div>","exportdata");
$.ajax({
type: 'GET',
url: servicePath,
data: JSON.stringify(data),
contentType: "application/json",
dataType: 'json',
success: function(data) {
windows.location(data);
},
complete:function(response) {
if(response.status==204) {
hideMessage("OOPS!! Error Occured during rms calculation","updatedata");
return;
}
response = response.responseText;
////////////////////////////console.log(response)
response = response.replace(/\\/g ,":");
response = response.replace(/\//g ,":");
////////////////////////////console.log(response);
window.location.replace(service_path+"/download/"+response);
hideMessage("Exporting data","exportdata")
},
error:function(data1) {
var message = "Error occurred while exporting data to excel";
hideMessage(message,"exportdata");
}
});
} else if (data != "") {
console.log("netting export to excel");
////////////console.log(data);
showMessage("Exporting Data..<div class='mdl-spinner mdl-js-spinner is-active'></div>","exportdata");
var servicePath = service_path + "/exportexcel";
var gridColumns = new Array();
$.each(current_table_columns[current_table],function(i,item){
gridColumns.push(item["column-name"]);
});
$("div.datacontainer[containerid="+current_containerid+"] div[gridid="+gridid+"] form.excelexport input[name=data]").val(data);
$("div.datacontainer[containerid="+current_containerid+"] div[gridid="+gridid+"] form.excelexport input[name=fieldlist]").val(JSON.stringify(gridColumns));
$("div.datacontainer[containerid="+current_containerid+"] div[gridid="+gridid+"] form.excelexport input[name=sheetname]").val(current_sheet_name);
$("div.datacontainer[containerid="+current_containerid+"] div[gridid="+gridid+"] form.excelexport input[name=tablename]").val(current_table);
$.ajax({
type: 'POST',
url: servicePath,
data: JSON.stringify(data),
contentType: "application/json",
dataType: 'json',
success: function(data) {
////////////////////////////console.log(data);
windows.location(data);
},
complete:function(response){
if(response.status==204){
hideMessage("OOPS!! Error Occured during rms calculation","updatedata");
return;
}
response = response.responseText;
////////////////////////////console.log(response)
response = response.replace(/\\/g ,":");
response = response.replace(/\//g ,":");
////////////////////////////console.log(response);
window.location.replace(service_path+"/download/"+response);
hideMessage("Exporting data","exportdata")
logAction("Data exported for "+current_table,"DATA_EXPORT");
},
error:function(data1){
var message = "Error occured while exporting data to excel";
hideMessage(message,"exportdata");
}
});
}
}
更新CDN后,数据将导出为空文件。列标题只会出现。