var gantryIds = new Array();
$('#dataList').on('uncheck.bs.table check.bs.table check-all.bs.table uncheck-all.bs.table',function(e,rows) {
var datas = $.isArray(rows) ? rows : [rows]; // 点击时获取选中的行或取消选中的行
append(e.type, datas); // 保存到gantryIds 数组中
})
function append(type,datas){
if(type.indexOf('uncheck')===-1){
$.each(datas,function(i,v){
// 添加时,判断一行或多行的 id 是否已经在数组里 不存则添加
gantryIds.indexOf(v.id) === -1 ? gantryIds.push(v.id) : -1;
});
}else{
$.each(datas,function(i,v){
gantryIds.splice(gantryIds.indexOf(v.id),1); //删除取消选中行
});
}
}