BootStrap--Table表格导出Excel

一、引入tableExport控件

tableExport.js

优点:方便开发者查看,兼容性高。缺点:浪费资源,使用此控件导出Excel为90k。

tableExport.min.js

优点:节约资源,使用此控件导出Excel为15k,兼容性高。缺点:不方便开发者查看。

下载地址:https://download.csdn.net/download/sweetwyl/10561518

二、使用方法

1.页面引入

    <script type="text/javascript" src="${contextPath}/resources/lib/assets/plugins/tableExport/tableExport.min.js" charset="UTF-8"></script>

 

 2.页面代码:

<button type="button" class="btn btn c-theme-btn" id="btn_download">数据导出</button>
	<table id="list-table" data-toolbar="#list-table-toolbar"
								data-show-refresh="true" data-show-columns="true"
								class="table table-bordered table-hover">
								<thead>
									<tr>
										<th data-align="center">用车人姓名</th>
										<th data-align="center">用车部门</th>
										<th data-align="center">用车时间</th>
										<th data-align="center">航班号</th>
										<th data-align="center">司机名称</th>
										<th data-align="center">司机电话</th>
										<th data-align="center">车牌号</th>
									</tr>
								</thead>
	</table>

 

3. JS代码:

$('body').on('click','#btn_download',function(){//添加按钮点击事件
      $('#list-table').tableExport( { type: 'excel', escape: 'false' , fileName: name + '导出数据表' });
  })

 

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值