Based on the checked Field to determine whether it is selected
layui.config({ base: '/static/layui/' }).extend({ treeTable:
'treetable/treetable' }); layui.use(['treeTable'], function () { var $ = layui.
jquery; var treeTable = layui.treeTable; treeTable = $.extend(treeTable, {
config: { checkName: 'checked' } }); var insTb = treeTable.render({ elem:
'#demoTreeTb', height: '480px', tree: { iconIndex: 0, // In which column does the collapse icon appear isPidData:
true, // Is it id,pid Formal data idName: 'menuId', // id Field name pidName: 'parentId' //
pid Field name }, cols: [ { field: 'name', title: ' Node name ' }, { field: 'path', title:
' route ' }, { field: 'state', title: ' state ', templet: function (res) { if (res.state
== 0) { return ' disabled ' } else { return ' available ' } } }, { fixed: 'right', type:
'checkbox', width: 150 } ], reqData: function (data, callback) { //
Write it here ajax request , adopt callback Method callback data $.get('/system/resource/list', function (res) { if (
res.code == 0) { var data = res.data; for (var x in data) { console.log(data[x])
if (data[x].checked) { data[x]["LAY_CHECKED"] = 'true'; var index = res.data[x][
'LAY_TABLE_INDEX']; $('tr[data-index=' + index + '] input[type="checkbox"]').
prop('checked', true); $('tr[data-index=' + index + '] input[type="checkbox"]').
next().addClass('layui-form-checked'); } } callback(res.data); } else callback(
res.msg); }); } }); // Listen for line tool events treeTable.on('tool(demoTreeTb)', function (obj) {
var data = obj.data; var id = data.id; console.log(data.id) if (obj.event ===
'remove') { } else if (obj.event === 'edit') { } }); var checkStatus; // check box
treeTable.on('checkbox(demoTreeTb)', function (obj) { console.log(insTb.
checkStatus()); }); $("#save").click(function () { console.log(checkStatus); })
});

Technology
©2020 ioDraw All rights reserved
Interview questions : Handwritten list ( Include reverse linked list )C Notes on language learning —— Pointer : Pointer and one dimensional array error: (-215:Assertion failed) Solution layui.table Examples of dynamically getting header and list data python Simple record of network programming After the outbreak Which programming has a bright future Java Summary of basic learning (162)—— How to ensure thread safety ?vue el-input Do not enter special characters Only numbers can be entered Regular verification MYSQL database DML Common commands python in list and str Mutual conversion