一.导包

<script src="static/js/plugin/table_export/table-export.js"></script>
<script src="static/js/plugin/table_export/tableExport.js"></script>
<script src="static/js/plugin/table_export/jquery.base64.js"></script>
<script src="static/js/plugin/table_export/main.js"></script>

链接: https://pan.baidu.com/s/1H2LUZTVVLpW8I29nwuodzw

提取码: 1234 

二.导出Excel

表格

<!--  bootstrap-table -->
<table id="tableGrid" data-height="488" data-mobile-responsive="true">
</table>

初始化加入

TableExport.init();

(1) 通过点击事件自定义导出Excel

<button class="btn btn-default" type="button" onclick="outExcel()" >导出Excel
</button>

导出

function outExcel() {      
$('#tableGrid').tableExport({
type: 'excel',
escape: 'true',
fileName: 'Excel统计表', //导出Excel的名称
ignoreColumn: [0, 1] //删除第0,1列
})
}

(2) 默认绑定事件

<button class="export-excel btn btn-default" data-table="#tableGrid"  type="button"  >导出Excel
</button>

注意:需要申明calss属性 export-excel 以及绑定data-table即表格table的id