我正在使用Gijgo库(https://gijgo.com/tree/demos/material-design-treeview-checkbox)在树中显示项目.我不希望在父 node 旁边有复选框(在图像中标记为红色).有人能帮我这个忙吗?
这是我显示树 struct 的方式:
var tree2 = $('#tree').tree({
uiLibrary: 'bootstrap4',
dataSource: '/products/getcategoriestree/' + get_configurator_id(),
iconsLibrary: 'fontawesome',
primaryKey: 'id',
checkboxes: true,
icons: {
expand: '<i class="fa fa-chevron-right"></i>',
collapse: '<i class="fa fa-chevron-down"></i>'
}, dataBound: function (e) {
tree2.expandAll();
}
});
我try 使用nodeDatBound函数迭代每个 node ,我可以获取我不想要的每个父项,但我不确定如何从特定 node 中删除复选框.
tree2.on('nodeDataBound', function (e, node, id, record) {
if (record["children"] != null) {
console.log("PARENT Record");
console.log(record);
console.log(node);
node.enableCheckBox = false;
}
});
另外,我不能更改库,它是遗留代码的一部分.