<input class="easyui-combotree" id="chooseOrg" style="width:190px;height:28px;"
data-options="cascadeCheck:false,onlyLeafCheck:true,editable:true,multiple:true,checkbox:true,prompt:'請選擇',url:'<%=path%>/client/treeList',method:'get',required:true,panelHeight:'300',onBeforeSelect:function(node){checkLeaf(node);},onClick:function(node){beforeCheck(node);}"/>
需要設置的屬性
cascadeCheck:false
onlyLeafCheck:true
multiple:true
checkbox:true
javascript代碼
//只允許選擇葉子結點
function checkLeaf(node){
console.log("checkLeaf");
var t = $(this).tree;
var isLeaf = t('isLeaf',node.target);
if(!isLeaf){
return false;
}
}
// 只允許勾選葉子節點
function beforeCheck(node){
if (!$(this).tree('isLeaf', node.target)) {
console.log("beforeCheck")
return false;
}
}
效果圖:
easyui關於combotree的說明文檔地址 http://www.jeasyui.net/plugins/185.html
另外一篇博客值得學習 https://blog.csdn.net/w995223851/article/details/88350060