Repository navigation
Expand file tree
/
Copy path3345.html
More file actions
54 lines (50 loc) · 1.4 KB
/
Copy path3345.html
File metadata and controls
54 lines (50 loc) · 1.4 KB
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
<script>
init({
title: 'Issue #3345',
desc: 'Check/Uncheck All in all page with server side(<a href="https://github.com/wenzhixin/bootstrap-table/issues/1167" target="_blank">#3345</a>).',
links: ['bootstrap-table.min.css'],
scripts: ['bootstrap-table.min.js']
})
</script>
<div class="toolbar">
<button id="checkAll" class="btn btn-secondary">Check All</button>
<button id="uncheckAll" class="btn btn-secondary">Uncheck All</button>
</div>
<table
id="table"
data-toggle="table"
data-url="https://examples.wenzhixin.net.cn/examples/bootstrap_table/data"
data-pagination="true"
data-side-pagination="server"
data-page-list="[5, 10, 20, 50, 100, 200]"
data-search="true"
data-toolbar=".toolbar"
data-response-handler="responseHandler">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="id">ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
</tr>
</thead>
</table>
<script>
var checkAll = false
function mounted() {
$('#checkAll').click(function () {
checkAll = true
$('#table').bootstrapTable('checkAll')
})
$('#uncheckAll').click(function () {
checkAll = false
$('#table').bootstrapTable('uncheckAll')
})
}
function responseHandler(res) {
res.rows.forEach(function (item) {
item.state = checkAll
})
return res
}
</script>