easyUI 多选tree点击节点即选中的方法



easyUI tree 树无法通过点击树节点,而将点击的节点选中,故在树中增加点击事件

window.onload = function(){
 $('#easyuiTree').tree({
     url:'',
     animate:true,
     lines:true,
     checkbox:true,
     onClick: function(node){

             //用state来接收当前点击节点的选中状态,true代表选中,false代表未选中
              var state = node.checked;
              //alert(node.checked);
        if(state==true){

            //选中则将其设为未选中
         $("#easyuiTree").tree('uncheck',node.target);
        }else if(state==false){

           //未选中则将其设为选中
         $("#easyuiTree").tree('check',node.target);
        }
     }
   
 });
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章