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);
})
}
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM