[coolite] TreePanel CheckBox联动

ERP-易飞
易飞ERP系统运维、二次开发、实施
厦门德仔

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;
            }
        }
    }
}

 

<Listeners>                                   
                                     
                                       
<CheckChange Handler="treepanelcheck(node)" />                                                              
                                    </Listeners>  

展开阅读全文
©️2020 CSDN 皮肤主题: 鲸 设计师: meimeiellie 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值