添加导出按钮
<button class="layui-btn pear-btn-md" id="export">
<i class="iconfont icon-export"></i> 导出
</button>
请求后台数据时,关联数据
function render(){
var ins1 = table.render({
elem: "#data-table",
url: SELECT_API,
page: true,
cols: [cols],
skin: "line",
size: "lg",
toolbar: "#table-toolbar",
autoSort: false,
defaultToolbar: [],
done: function (res, curr, count) {
exportData=res.data;
layer.photos({ photos: 'div[lay-id="data-table"]', anim: 5});}
});
$("#export").click(function(){
table.exportFile(ins1.config.id,exportData, 'xls','qe');
})
}
点击导出按钮导出表单数据