layui中layuiXtree与table中的checkbox冲突

解决layuiXtree设置单选后table中checkbox无法多选

原先写法:form.on('checkbox', function () {
$("[type='checkbox']").prop("checked", "");
$(this).prop("checked", "checked");
form.render('checkbox');
})

<div id="xtree1" class="layui-form xtree-main layui-row" style="padding: 10px 0 0 5px;">

</div>

改动后:form.on('checkbox', function () {
$("#xtree1").find("[type='checkbox']").prop("checked", false);
$("#xtree1").find(this).prop("checked", true);
form.render('checkbox');
})

解决layuiXtree渲染后table中checkbox监听事件失效

table.on('checkbox(filter)', function (obj) {//checkbox选中后操作});监听事件前加上form.on('checkbox', function (obj) {});

原文地址:https://www.cnblogs.com/yyjspace/p/11599006.html