1.更新表格數據(根據行索引:僅更新一個單元格)
var rows = {index : index, //更新列所在行的索引field : "status", //要更新列的fieldvalue : "正常" //要更新列的數據
}
$('#table_Id').bootstrapTable("updateCell",rows);
2.更新表格數據(根據特定的id:可直接更新一行數據)
var NUM=1,row={name:'小紅',age:20}
$('#table_Id').bootstrapTable('updateByUniqueId', { id: NUM, row: row });
3.增加表格數據(表格最前方添加:可僅添加部分數據)
var row = {name:'小紅',age:20
}
$("#table_Id").bootstrapTable('prepend',row);
4.增加表格數據(表格最后方添加:可僅添加部分數據)
var row = {name:'小紅',age:20
}
$("#table_Id").bootstrapTable('append',row);
5.刪除表格數據(根據指定列及取值批量刪除)
var names=['小紅','小黃','小藍']
$("table_Id").bootstrapTable('remove', { field: "name", values: names });
6.刪除表格數據(根據特定的id刪除一行)
var id=001
$("table_Id").bootstrapTable('removeByUniqueId', id);
7.刪除表格所有數據
$("#table_Id").bootstrapTable('removeAll');