zoukankan      html  css  js  c++  java
  • EasyUI tree 选中父节点子节点全部选中,选中子节点父节点不选中

    需求:EasyUI tree 选中父节点子节点全部选中,选中子节点父节点不选中

    效果:

              

    1.  
      /**
    2.  
      * 给树增加onCheck事件,首先使用cascadeCheck:false属性禁止全选,
    3.  
      * 然后获取当前选中节点的所有子节点,在判断其拥有子节点时对其所有字节点
    4.  
      * 进行遍历操作。在easyui中树节点的是否选中不是由checked:true
    5.  
      * 属性来控制,而是由class tree-checkbox0
    6.  
      * 和tree-checkbox1进行控制。--by wk
    7.  
      */
    8.  
      cascadeCheck:false,//取消勾选属性
    9.  
      onCheck:function(node, checked){
    10.  
      var childList = $(this).tree('getChildren',node.target);
    11.  
      if(childList.length>0){
    12.  
      var checkedTrue = function(){
    13.  
      childList.map(function(currentValue){
    14.  
      $("div[node-id='"+currentValue.id+"']").find(".tree-checkbox").removeClass("tree-checkbox0").addClass("tree-checkbox1");
    15.  
      })
    16.  
      };
    17.  
      var checkedFalse = function(){
    18.  
      $.each(childList,function(index,currentValue){
    19.  
      $("div[node-id='"+currentValue.id+"']").find(".tree-checkbox").removeClass("tree-checkbox1").addClass("tree-checkbox0");
    20.  
      })
    21.  
      };
    22.  
      var checkChangeProperties = checked==true ? checkedTrue() : checkedFalse();
    23.  
      }
    24.  
      }
  • 相关阅读:
    20200910-3 命令行和控制台编程
    C语言1作业04
    C语言1博客作业03
    c语言1博客作业02
    2018寒假作业--3抓老鼠啊~亏了还是赚了?
    2018寒假作业2--币值转换
    2018寒假作业-1 打印沙漏
    记叙在人生路上对我影响最大的三位老师
    自我介绍
    抓老鼠啊~亏了还是赚了?编程总结
  • 原文地址:https://www.cnblogs.com/wangluochong/p/9374925.html
Copyright © 2011-2022 走看看