Skip to content

Commit ef3a9b5

Browse files
committed
Merge pull request wenzhixin#92 from sketchman-nyt/feature/updateByUniqueId
New Method Example: updateByUniqueId
2 parents 666bba0 + 6e22477 commit ef3a9b5

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
<li><a href="methods/removeByUniqueId.html">removeByUniqueId</a></li>
7171
<li><a href="methods/insertRow.html">insertRow</a></li>
7272
<li><a href="methods/updateRow.html">updateRow</a></li>
73+
<li><a href="methods/updateByUniqueId.html">updateByUniqueId</a></li>
7374
<li><a href="methods/showRow-hideRow.html">showRow/hideRow</a></li>
7475
<li><a href="methods/mergeCells.html">mergeCells</a></li>
7576
<li><a href="methods/checkAll-uncheckAll.html">checkAll/uncheckAll</a></li>

methods/updateByUniqueId.html

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>updateByUniqueId</title>
5+
<meta charset="utf-8">
6+
<link rel="stylesheet" href="../assets/bootstrap/css/bootstrap.min.css">
7+
<link rel="stylesheet" href="../assets/bootstrap-table/src/bootstrap-table.css">
8+
<link rel="stylesheet" href="../assets/examples.css">
9+
<script src="../assets/jquery.min.js"></script>
10+
<script src="../assets/bootstrap/js/bootstrap.min.js"></script>
11+
<script src="../assets/bootstrap-table/src/bootstrap-table.js"></script>
12+
<script src="../ga.js"></script>
13+
</head>
14+
<body>
15+
<div class="container">
16+
<h1>updateByUniqueId</h1>
17+
<p>
18+
Update the specified row, the param contains following properties: <br>
19+
id: a row id where the id should be the uniqueid field assigned to the table. <br>
20+
row: the new row data.
21+
<code>$table.bootstrapTable('updateByUniqueId', {id: 3, row: row});</code>
22+
</p>
23+
<div id="toolbar">
24+
<button id="button" class="btn btn-default">updateByUniqueId</button>
25+
</div>
26+
<table id="table"
27+
data-toggle="table"
28+
data-toolbar="#toolbar"
29+
data-height="428"
30+
data-unique-id="id"
31+
data-url="../json/data1.json">
32+
<thead>
33+
<tr>
34+
<th data-field="id">ID</th>
35+
<th data-field="name">Item Name</th>
36+
<th data-field="price">Item Price</th>
37+
</tr>
38+
</thead>
39+
</table>
40+
</div>
41+
<script>
42+
var $table = $('#table'),
43+
$button = $('#button');
44+
45+
$(function () {
46+
$button.click(function () {
47+
var randomId = 100 + ~~(Math.random() * 100);
48+
$table.bootstrapTable('updateByUniqueId', {
49+
id: 3,
50+
row: {
51+
name: 'Item ' + randomId,
52+
price: '$' + randomId
53+
}
54+
});
55+
});
56+
});
57+
</script>
58+
</body>
59+
</html>

0 commit comments

Comments
 (0)