-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy path987.html
67 lines (62 loc) · 1.31 KB
/
987.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
<script>
init({
title: 'Issue #987',
desc: 'Save row data using input.(<a href="https://github.com/wenzhixin/bootstrap-table/issues/987" target="_blank">#987</a>).',
links: ['bootstrap-table.min.css'],
scripts: ['bootstrap-table.min.js']
})
</script>
<template>
<table
id="table"
data-toggle="table"
data-search="true"
data-url="json/data1.json"
>
<thead>
<tr>
<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>
<th
data-field="selling"
data-formatter="inputFormatter"
data-events="inputEvents"
>
Selling
</th>
</tr>
</thead>
</table>
</template>
<script>
const $table = $('#table')
window.inputFormatter = value => {
const checked = value ? 'checked' : ''
return `<input type="checkbox" ${checked}>`
}
window.inputEvents = {
'change :checkbox' (e, value, row, index) {
row.selling = $(e.target).prop('checked')
$table.bootstrapTable('updateRow', {
index,
row
})
}
}
</script>