我想出了解决办法。我只需要在加载数据后执行bsTable初始化代码,而不是在之前初始化。
Updated plnkr
$timeout(function(){
console.log("timedout");
$scope.bsTableControl = {
options: {
data: makeRandomRows({ workspace: "test"}),
rowStyle: function (row, index) {
return { classes: 'none' };
},
cache: false,
height: 400,
striped: true,
pagination: true,
pageSize: 10,
pageList: [5, 10, 25, 50, 100, 200],
search: true,
showColumns: true,
showRefresh: false,
minimumCountColumns: 2,
clickToSelect: false,
showToggle: true,
maintainSelected: true,
columns: [{
field: 'state',
checkbox: true
}, {
field: 'index',
title: '#',
align: 'right',
valign: 'bottom',
sortable: true
}, {
field: 'id',
title: 'Item ID',
align: 'center',
valign: 'bottom',
sortable: true
}, {
field: 'name',
title: 'Item Name',
align: 'center',
valign: 'middle',
sortable: true
}, {
field: 'flag',
title: 'Flag',
align: 'center',
valign: 'middle'
}]
}
};
}, 2000);