jQuery MiniUI
标题:
导出excel的这个export.aspx代表什么,怎么做
[打印本页]
作者:
hongye
时间:
2019-11-13 16:15:32
标题:
导出excel的这个export.aspx代表什么,怎么做
function ExportExcel() {
var columns = grid.columns;
function getColumns(columns) {
var cols = [];
for (var i = 0; i < columns.length; i++) {
var column = columns[i];
var col = { header: column.header, field: column.field, type: column.type };
if (column.columns) {
col.columns = getColumns(column.columns);
}
cols.push(col);
}
return cols;
}
var columns = getColumns(columns);
DownLoad("export.aspx", { type: "excel", columns: columns }, function () {
//alert("导出成功");
});
}
function DownLoad(url, fields, callback) {
//创建Form
var submitfrm = document.createElement("form");
submitfrm.action = url;
submitfrm.method = "post";
submitfrm.target = "_blank";
document.body.appendChild(submitfrm);
if (fields) {
for (var p in fields) {
var input = mini.append(submitfrm, "<input type='hidden' name='" + p + "'>");
var v = fields[p];
if (typeof v != "string") v = mini.encode(v);
input.value = v;
}
}
submitfrm.submit();
setTimeout(function () {
submitfrm.parentNode.removeChild(submitfrm);
if (callback) callback();
}, 1000);
}
作者:
felt
时间:
2019-11-13 16:58:47
请运行我们试用包内导出的例子看效果
我们用的是后台导出,前端提交了表格列数据到后台,后台进行组装导出
欢迎光临 jQuery MiniUI (http://miniui.com/discuss/)
Powered by Discuz! X2