Guns整合tableExpore进行数据导出

Jquery tableExcel.js下载地址:https://github.com/kayalshri/tableExport.jquery.plugin

1 添加tableExcel.js

2 在需要进行导出的页面添加导出按钮

<#button name="导出" icon="fa-share" clickFun="MgrUser.export()" space="true"/>

(其中icon可在这里寻找)

3 编辑JS代码

MgrUser.export = function () {
    $('#managerTable').tableExport({type:'excel', fileName: new Date().getTime(), escape:'false'});
}

解析:

$("#table_1").tableExport({…});//获取到所指定的表,将其导出

即:$(表的id).tableExport({…});

type:'excel',//将表导出的格式,这边为excel,也可以为txt/pdf/json/xml等

fileName: new Date().getTime(),//设置导出的表的默认名称

escape:'false', //这边设置为false

ignoreColumn:'[5]'}//表示忽略列数,在这表示把第五列的数据给忽略掉,不在Excel中显示
 

猜你喜欢

转载自blog.csdn.net/zgsdzczh/article/details/87608262