示例代码如下:
var emptyData = {id: "12345", txt: "aaaa"};
$("#table").bootstrapTable("insertRow", {index: 0, row: emptyData});
var oldRow = $("#table").bootstrapTable("getRowByUniqueId", "12345");
oldRow is null
你设置 data-unique-id="id" 了没 要先设置唯一键
var emptyData = {id: "12345", txt: "aaaa"};
这么设置id的话,id变成了个字符串;
"getRowByUniqueId"需要数字,这样设置才对:
var emptyData = {id: 12345, txt: "aaaa"};
应该是使用的问题,假如问题存在重新打开问题
getRowByUniqueId,取不到值,返回的是一个dom,主键是个uuid
@problemking 例子是可以的:https://examples.bootstrap-table.com/index.html#methods/get-row-by-unique-id.html
Most helpful comment
你设置 data-unique-id="id" 了没 要先设置唯一键