1. 程式人生 > >EasyUI 中combotree 預設不能選擇父節點

EasyUI 中combotree 預設不能選擇父節點

這需要新增如下欄位就行,搜了半天,說什麼判斷是不是子節點什麼的,都是胡扯!

onlyLeafCheck:true,

//病因分類 
$('#artReason').combotree({
width:200,
method:'GET',
   //url: '${ctx}/business/dict/json/DicEtilolgy',
   data:DicEtilolgy_data,
   idField : 'id',
   textFiled : 'name',
parentField : 'pid',
   animate:true,
   mode:'local',
   multiple: true,
   onlyLeafCheck:true,


   onbeforeselect:function(node){
   debugger;
                alert(node.state);
                if(node.state){
                    $("#artReason").tree("unselect");
                }
            },
onClick:function(data){
return;
debugger;
},
   onLoadSuccess:function(node,data){
//     $("#artReason").combotree('setValue',['11','12']);
   
   },
//    onSelect : function(node) { 
//     debugger;
//     if(parseInt(node.id)<10){
//     $('#artReason').combotree('clear');
//     return;
//     }
//        //返回樹物件  
//        var tree = $(this).tree;  
//        //選中的節點是否為葉子節點,如果不是葉子節點,清除選中  
//        var isLeaf = tree('isLeaf', node.target);  
//        if (!isLeaf) {  
//            //清除選中  
//            $('#artReason').combotree('clear');  
//        }  
//    },  
   onChange:function(newValue, oldValue) { 
   debugger;
   },
//    filter:function(q,row){ 
//     debugger;
//     var opts=$(this).combobox("options"); 
//     return row[opts.textField].indexOf(q)>-1;//將從頭位置匹配改為任意匹配 
//     },
});