zoukankan      html  css  js  c++  java
  • coolite TreePanel CheckBox联动

    代码
    <Listeners>

    <CheckChange Handler="treepanelcheck(node)" />
    </Listeners>
    代码
    function treepanelcheck(item) {

    treepanelchildcheck(item);
    treepanelparentcheck(item);
    }
    function treepanelchildcheck(item) {
    var chNode;

    if (item.childNodes.length > 0) {
    if (item.attributes.checked == true) {
    for (var i = 0; i < item.childNodes.length; i++) {
    chNode
    = item.childNodes[i];
    chNode.attributes.checked
    = true;
    chNode.getUI().checkbox.checked
    = true;


    }
    }
    if (item.attributes.checked == false) {
    for (var i = 0; i < item.childNodes.length; i++) {
    chNode
    = item.childNodes[i];
    chNode.attributes.checked
    = false;
    chNode.getUI().checkbox.checked
    = false;

    }
    }
    }
    }
    function treepanelparentcheck(item) {
    var chNode;
    var checkBool;
    if (item.parentNode.parentNode != null) {
    if (item.attributes.checked == false) {

    for (var i = 0; i < item.parentNode.childNodes.length; i++) {

    chNode
    = item.parentNode.childNodes[i];
    if (chNode.attributes.checked == true) {
    checkBool
    = true;
    break;
    }

    //chNode.attributes.checked = true;

    }
    if (checkBool == true) {
    item.parentNode.attributes.checked
    = true;
    item.parentNode.getUI().checkbox.checked
    = true;
    }
    else {
    item.parentNode.attributes.checked
    = false;
    item.parentNode.getUI().checkbox.checked
    = false;
    }
    }
    if (item.attributes.checked == true) {
    item.parentNode.attributes.checked
    = true;
    if (item.parentNode.getUI().checkbox != null) {
    item.parentNode.getUI().checkbox.checked
    = item.attributes.checked;
    }
    }
    }
    }

  • 相关阅读:
    如何在linux下解压缩rar格式的文件压缩包
    CentOS-6.3安装配置SVN
    codeblock 设置背景颜色
    leetcode[55] Merge Intervals
    leetcode Jump Game
    leetcode Spiral Matrix
    leetcode Maximum Subarray
    leetcode N-QueensII
    leetcode[50] N-Queens
    leetcod Pow(x, n)
  • 原文地址:https://www.cnblogs.com/hanli/p/1755796.html
Copyright © 2011-2022 走看看