获取选中行数据
获取选中数目
验证是否全选
提交选择
ID运动名运动时长运动类型
var msg="";
var idlist="";
layui.use('table', function(){
var table = layui.table;
//监听表格复选框选择
table.on('checkbox(demo)', function(obj){
});
var $ = layui.$, active = {
getCheckData: function(){ //获取选中数据
msg="";
idlist="";
var checkStatus = table.checkStatus('idTest')
,data = checkStatus.data;
for(var i=0; i
msg=msg+"周"+(i+1)+":"+data[i].sportName+" ";
idlist =idlist+data[i].sportId+",";
}
}
,getCheckLength: function(){ //获取选中数目
var checkStatus = table.checkStatus('idTest')
,data = checkStatus.data;
layer.msg('选中了:'+ data.length + ' 个');
}
,isAll: function(){ //验证是否全选
var checkStatus = table.checkStatus('idTest');
layer.msg(checkStatus.isAll ? '全选': '未全选')
}
};
$('.demoTable .layui-btn').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
function submitmychose(){
$('#hqsj').trigger("click");
}