html里的控件事件:
onbeforenodeselect = beforenodeselect
js里:
beforenodeselect : function(e){
//禁止选中父节点
if (e.isLeaf == false) e.cancel = true;
}
以上来源:https://www.cnblogs.com/attlia/p/3660721.html
<ul id="orgTree" class="mini-tree" style="margin-top: 10px;height: calc(100% - 50px);"
ajaxOptions="{async: false}"
showTreeIcon="true" textField="text" idField="id" parentField="parentId" bType="bType"
resultAsTree="false"
url="" expandOnLoad="true" onbeforenodeselect="beforenodeselect">
</ul>
//绑定树节点 被选中事件
tree.on("nodeclick", function (e) {
var type = e.record.bType;
slectNodeId = e.node.id;
if (e.isLeaf == false || e.node.id.startsWith("system")) {
//非叶子节点,或者system
} else {
grid.load();
}
});
function beforenodeselect(e) {
//非叶子节点,或者system
if (e.isLeaf == false || e.node.id.startsWith("system")) {
e.cancel = true;
}
}