Box:true,formatter : stateFormatter
},{
field: 'id',title: '组织编码',sortable: true,},{
field: 'name',title: '组织名称',}],});
//对应的函数进行判断;
function stateFormatter(value,row,index) {
if (row.state == true)
return {
disabled : false,//设置是否可用
checked : true//设置选中
};
return value;
}
模拟后台对应的数据;
[
{
"id": "1","name": "金蝶软件(中国)有限公司","state": false,//是否选中
"tel":"18536552258"
},{
"id": "2","state": true,"tel":"18536552258"
},{
"id": "3","tel":"18536552258"
}
]
以上所述是小编给大家介绍的BootStrap Table复选框默认选中功能的实现代码(从数据库获取到对应的状态进行判断是否为选中状态)。编程之家 jb51.cc 收集整理的教程希望能对你有所帮助,如果觉得编程之家不错,可分享给好友!感谢支持。