Repository navigation
Expand file tree
/
Copy pathtable-classes.html
More file actions
91 lines (84 loc) · 1.81 KB
/
Copy pathtable-classes.html
File metadata and controls
91 lines (84 loc) · 1.81 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
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
<script>
init({
title: 'Table Classes',
desc: 'Use `classes` option to set the table styles. The default `classes` is `\'table table-bordered table-hover\'`.',
links: ['bootstrap-table.min.css'],
scripts: ['bootstrap-table.min.js']
})
</script>
<style>
.checkbox {
float: left;
margin-right: 15px;
}
</style>
<div class="toolbar">
<div class="checkbox">
<label>
<input type="checkbox" checked disabled>
<code>table</code>
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" checked>
<code>table-bordered</code>
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" checked>
<code>table-hover</code>
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox">
<code>table-striped</code>
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox">
<code>table-dark</code>
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox">
<code>table-sm</code>
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox">
<code>table-borderless</code>
</label>
</div>
</div>
<table
id="table"
data-url="json/data1.json">
<thead>
<tr>
<th data-field="id">Item ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
</tr>
</thead>
</table>
<script>
var $table = $('#table')
function mounted() {
$table.bootstrapTable()
$('.toolbar input').change(function () {
var classes = []
$('.toolbar input:checked').map(function () {
classes.push($(this).next().text())
})
$table.bootstrapTable('refreshOptions', {
classes: classes.join(' ')
})
})
}
</script>