bootstrapTable复选框,翻页后之前选中的记录消失

百度里查的方法,记录下来,方便以后查阅

        columns: [
{
checkbox: true,
formatter: function (i,row) {
if($.inArray(row.id,overAllIds)!=-1){
return{
checked:true
}
}
}
},
$('#dataTable').on('uncheck.bs.table check.bs.table check-all.bs.table uncheck-all.bs.table',function (e,rows) {
var datas=$.isArray(rows)?rows:[rows];
examine(e.type,datas);
});
var overAllIds = new Array();
function examine(type, datas) {
if (type.indexOf('uncheck') == -1) {
$.each(datas, function (i, v) {
overAllIds.indexOf(v.id)==-1?overAllIds.push(v.id):-1;
});
} else {
$.each(datas, function (i, v) {
overAllIds.splice(overAllIds.indexOf(v.id),1);
})
}
}
原文地址:https://www.cnblogs.com/jakin3130/p/10755231.html