layui table 单击行选中复选框

table.on('row(LAY-role-list)', function (obj) {
    //用obj.tr.eq(0)不行,有2行
	var cbox = obj.tr.find('.layui-form-checkbox'), rowindex = obj.tr.eq(0).data("index");
	if (cbox.hasClass('layui-form-checked')) {
		cbox.removeClass("layui-form-checked");
		delete table.cache['LAY-role-list'][rowindex][table.config.checkName];
	}
	else {
		cbox.addClass("layui-form-checked");
		table.cache['LAY-role-list'][rowindex][table.config.checkName] = true;
	}
	window._selectRole = { RoleID: obj.data.RoleID, RoleName: obj.data.RoleName };
	table.reload('LAY-roleuser-list', {where:getRoleUserParas()});
});

//table.checkStatus('LAY-role-list') 可以获取到勾选的行

猜你喜欢

转载自blog.csdn.net/zhchfsky/article/details/125747617