Bootstrap Table

by wenyi

HTML

<script src="//rawgit.com/hhurz/tableExport.jquery.plugin/master/tableExport.js"></script>
<link rel="stylesheet" href="https://rawgit.com/wenzhixin/bootstrap-table/master/dist/bootstrap-table.css">
<script src="https://rawgit.com/wenzhixin/bootstrap-table/master/dist/bootstrap-table.js"></script>
<script src="https://rawgit.com/wenzhixin/bootstrap-table/master/dist/extenstions/export/bootstrap-table-export.js"></script>
<div id="toolbar">
  <button id="export" class="btn btn-default">Export Excel</button>
</div>
<table id="table"
       data-toggle="table"
       data-toolbar="#toolbar"
       data-show-export="true"
       data-pagination="true"
       data-page-size=2
       data-url="/gh/get/response.json/wenzhixin/bootstrap-table/tree/master/docs/data/data1/">
    <thead>
    <tr>
        <th data-field="state" data-checkbox="true"></th>
        <th data-field="name">Name</th>
        <th data-field="stargazers_count">Stars</th>
        <th data-field="forks_count">Forks</th>
        <th data-field="description">Description</th>
    </tr>
    </thead>
</table>

JavaScript

$(function () {
	var $table = $('#table');
  
    $('#export').bootstrapTable('refreshOptions',{
      exportDataType: 'all'
    });
  
	$('#export').click(function () {
  	$table.bootstrapTable('exportTable');
  });
});