Bootstrap-table: bootstraptable insertRow 的记录不能通过 getRowByUniqueId 获得记录内容

Created on 30 Aug 2016  ·  5Comments  ·  Source: wenzhixin/bootstrap-table

示例代码如下:

var emptyData = {id: "12345", txt: "aaaa"};
$("#table").bootstrapTable("insertRow", {index: 0, row: emptyData});

var oldRow = $("#table").bootstrapTable("getRowByUniqueId", "12345");

oldRow is null

help-wanted

Most helpful comment

你设置 data-unique-id="id" 了没 要先设置唯一键

All 5 comments

你设置 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

Was this page helpful?
0 / 5 - 0 ratings