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