-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
190 lines (176 loc) · 6.19 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Hello, Bootstrap Table!</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/bootstrap-table.min.css">
<link href="https://unpkg.com/[email protected]/dist/bootstrap-table.min.css" rel="stylesheet">
</head>
<body class="p-5">
<h1 class="text-center mb-5">Bootstrap Table With All Advanced Featutre</h1>
<div class="container">
<div id="toolbar" class="select">
<select class="form-control">
<option value="">Export Basic</option>
<option value="all">Export All</option>
<option value="selected">Export Selected</option>
</select>
</div>
<table id="table"
data-height="600"
data-show-toggle="true"
data-toggle="table"
data-pagination="true" //forpagination
data-search="true" //forsearch
data-seacrh-align="left"
data-show-columns="true"
data-show-columns-toggle-all="true"
data-show-refresh="true"
data-show-fullscreen="true"
data-show-pagination-switch="true"
data-pagination-pre-text="Previous"
data-pagination-next-text="Next"
data-pagination-h-align="left"
data-pagination-detail-h-align="right"
data-page-list="[10,20,30,40,50,All]"
data-filter-control="true"
data-show-search-clear-button="true"
data-advanced-search="true"
data-id-table="advancedTable"
data-toolbar="#toolbar"
data-show-print="true"
data-show-export="true"
data-click-to-select="true"
>
<thead>
<tr>
<th data-field="state" data-checkbox="true" data-visible="false"></th>
<th data-field="id">ID</th>
<th data-field="name" data-filter-control="input" data-sortable="true">Item Name</th>
<th data-field="price" data-filter-control="select" data-sortable="true">Item Price</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>1</td>
<td>Item 1</td>
<td>$1</td>
</tr>
<tr>
<td></td>
<td>2</td>
<td>Item 2</td>
<td>$2</td>
</tr>
<tr>
<td></td>
<td>2</td>
<td>Item 2</td>
<td>$2</td>
</tr>
<tr>
<td></td>
<td>2</td>
<td>Item 2</td>
<td>$2</td>
</tr>
<tr>
<td></td>
<td>2</td>
<td>Item 2</td>
<td>$2</td>
</tr>
<tr>
<td></td>
<td>2</td>
<td>Item 2</td>
<td>$2</td>
</tr>
<tr>
<td></td>
<td>2</td>
<td>Item 2</td>
<td>$2</td>
</tr>
<tr>
<td></td>
<td>2</td>
<td>Item 2</td>
<td>$2</td>
</tr>
<tr>
<td></td>
<td>2</td>
<td>Item 2</td>
<td>$2</td>
</tr>
<tr>
<td></td>
<td>2</td>
<td>Item 2</td>
<td>$2</td>
</tr>
<tr>
<td></td>
<td>2</td>
<td>Item 2</td>
<td>$2</td>
</tr>
<tr>
<td></td>
<td>2</td>
<td>Item 2</td>
<td>$2</td>
</tr>
</tbody>
</table>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="https://unpkg.com/tableexport.jquery.plugin/tableExport.min.js"></script>
<script src="https://unpkg.com/tableexport.jquery.plugin/libs/jsPDF/jspdf.min.js"></script>
<script src="https://unpkg.com/tableexport.jquery.plugin/libs/jsPDF-AutoTable/jspdf.plugin.autotable.js"></script>
<script src="https://unpkg.com/[email protected]/dist/bootstrap-table.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/extensions/export/bootstrap-table-export.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/extensions/filter-control/bootstrap-table-filter-control.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/extensions/toolbar/bootstrap-table-toolbar.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/extensions/print/bootstrap-table-print.min.js"></script>
<script>
$(function() {
$('#table').bootstrapTable()
})
var $table = $('#table')
$(function() {
$('#toolbar').find('select').change(function () {
$table.bootstrapTable('destroy').bootstrapTable({
exportDataType: $(this).val(),
exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel', 'pdf'],
columns: [
{
field: 'state',
checkbox: true,
visible: $(this).val() === 'selected'
},
{
field: 'id',
title: 'ID'
}, {
field: 'name',
title: 'Item Name'
}, {
field: 'price',
title: 'Item Price'
}
]
})
}).trigger('change')
})
</script>
</body>
</html>