-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathreorder-rows.html
78 lines (74 loc) · 1.59 KB
/
reorder-rows.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
<script>
init({
title: 'Reorder Rows',
desc: 'Use Plugin: <a href="https://github.com/isocra/TableDnD" target="_blank">TableDnD</a> and bootstrap-table-reorder-rows.',
links: [
'bootstrap-table.min.css',
'extensions/reorder-rows/bootstrap-table-reorder-rows.css'
],
scripts: [
'https://cdn.jsdelivr.net/npm/tablednd@1.0.5/dist/jquery.tablednd.min.js',
'bootstrap-table.min.js',
'extensions/reorder-rows/bootstrap-table-reorder-rows.min.js'
]
})
</script>
<template>
<div class="toolbar">
<button
id="button"
class="btn btn-secondary"
>
getData
</button>
</div>
<table
id="table"
data-pagination="true"
data-search="true"
data-show-toggle="true"
data-toolbar=".toolbar"
data-use-row-attr-func="true"
data-reorderable-rows="true"
data-url="json/data1.json"
>
<thead>
<tr>
<th
data-field="state"
data-checkbox="true"
>
ID
</th>
<th
data-field="id"
data-sortable="true"
>
ID
</th>
<th
data-field="name"
data-sortable="true"
>
Item Name
</th>
<th
data-field="price"
data-sortable="true"
>
Item Price
</th>
</tr>
</thead>
</table>
</template>
<script>
function mounted () {
$('#table').bootstrapTable()
$('#button').click(function () {
alert(JSON.stringify($('#table').bootstrapTable('getData').map(function (row) {
return row.id
})))
})
}
</script>