Skip to content

Commit e5708d1

Browse files
committed
Update welcome and index.
1 parent 3eba74d commit e5708d1

File tree

2 files changed

+46
-15
lines changed

2 files changed

+46
-15
lines changed

index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@
174174
</a></li>
175175
<li><a href="issues/917.html">
176176
917. Maintain selected on server side.
177+
</a></li>
178+
<li><a href="issues/986.html">
179+
986. Editable select box
177180
</a></li>
178181
</ul>
179182
</li>

welcome.html

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,6 @@ <h1>Bootstrap Table Examples <a href="https://github.com/wenzhixin/bootstrap-tab
4747
data-side-pagination="server"
4848
data-url="/examples/bootstrap_table/data"
4949
data-response-handler="responseHandler">
50-
<thead>
51-
<tr>
52-
<th data-field="state" data-checkbox="true"></th>
53-
<th data-field="id" data-sortable="true"
54-
data-footer-formatter="totalTextFormatter">ID</th>
55-
<th data-field="name" data-sortable="true" data-editable="true"
56-
data-footer-formatter="totalNameFormatter">Item Name</th>
57-
<th data-field="price" data-sortable="true" data-editable="true"
58-
data-footer-formatter="totalPriceFormatter">Item Price</th>
59-
<th data-field="operate"
60-
data-formatter="operateFormatter"
61-
data-events="operateEvents">Item Operate</th>
62-
</tr>
63-
</thead>
6450
</table>
6551
</div>
6652

@@ -71,7 +57,49 @@ <h1>Bootstrap Table Examples <a href="https://github.com/wenzhixin/bootstrap-tab
7157

7258
$(function () {
7359
$table.bootstrapTable({
74-
height: getHeight()
60+
height: getHeight(),
61+
columns: [{
62+
field: 'state',
63+
checkbox: true
64+
}, {
65+
field: 'id',
66+
title: 'ID',
67+
sortable: true,
68+
footerFormatter: totalTextFormatter
69+
}, {
70+
field: 'name',
71+
title: 'Item Name',
72+
sortable: true,
73+
editable: true,
74+
footerFormatter: totalNameFormatter
75+
}, {
76+
field: 'price',
77+
title: 'Item Price',
78+
sortable: true,
79+
editable: {
80+
type: 'text',
81+
title: 'Item Price',
82+
validate: function (value) {
83+
value = $.trim(value);
84+
if (!value) {
85+
return 'This field is required';
86+
}
87+
if (!/^$/.test(value)) {
88+
return 'This field needs to start width $.'
89+
}
90+
var data = $table.bootstrapTable('getData'),
91+
index = $(this).parents('tr').data('index');
92+
console.log(data[index]);
93+
return '';
94+
}
95+
},
96+
footerFormatter: totalPriceFormatter
97+
}, {
98+
field: 'operate',
99+
title: 'Item Operate',
100+
events: operateEvents,
101+
formatter: operateFormatter
102+
}]
75103
});
76104
$table.on('check.bs.table uncheck.bs.table ' +
77105
'check-all.bs.table uncheck-all.bs.table', function () {

0 commit comments

Comments
 (0)