layui框架table表格实现单击行选中checkbox功能

layui.table.on('row(operateEvent)', function (obj) {
	var tableDiv;
     var index = $(obj.tr.selector).attr('data-index');
     var tableBox = $(obj.tr.selector).parents('.layui-table-box');
    //存在固定列
     if (tableBox.find(".layui-table-fixed.layui-table-fixed-l").length>0) {
         tableDiv = tableBox.find(".layui-table-fixed.layui-table-fixed-l");
     } else {
         tableDiv = tableBox.find(".layui-table-body.layui-table-main");
     }
    var checkCell = tableDiv.find("tr[data-index=" + index + "]").find("td div.layui-table-cell div.layui-form-radio");
	        checkCell.on("click", function (e) {
	             $(this).off();
	             e.stopPropagation();
	         });
	        checkCell.find('i').click();
	 });

你可能感兴趣的:(js)