a_lai_tree相关

/***************************************
        阿赖目录树控件应用示例
选择上级或取消上级节点,其所属下级子节点不能全选或者全取消
*******************************************/
var tree1=new alai_tree_pretty(divTree1)
var root=tree1.root
//var n1=root.add("生产部")
var n1=tree1.addChkNode(root,"生产部")
    var n11=tree1.addChkNode(n1,"工程科")
    var n111=tree1.addChkNode(n11,"Sammy1")
    var n112=tree1.addChkNode(n11,"Sammy2")
    var n12=tree1.addChkNode(n1,"Gigi")
    var n13=tree1.addChkNode(n1,"John Lin")
//var n2=root.add("IT部")
var n2=tree1.addChkNode(root,"IT部")
    tree1.addChkNode(n2,"Rosanna")
    tree1.addChkNode(n2,"Angela Lee")
    tree1.addChkNode(n2,"Mathew Yang")
    tree1.addChkNode(n2,"Remmy")
    tree1.addChkNode(n2,"Laily")
//var n3=root.add("财务部")
var n3=tree1.addChkNode(root,"财务部")
    tree1.addChkNode(n3,"Coco Tang")
    tree1.addChkNode(n3,"Tony Su")
    tree1.addChkNode(n3,"Lisa")
tree1.oncheck=function(srcNode)
{
    if(srcNode.checkBox.checked)  // 选中
    {
            var node = srcNode.first;
            while (node != null)
            {
                node.checkBox.checked = true;
                node = node.next;
            }
    }
    else    //取消
    {
            var node = srcNode.first;
            while (node != null)
            {
                node.checkBox.checked = false;
                node = node.next;
            }
    }
}
n11.checkBox.checked=n12.checkBox.checked=n13.checkBox.checked=true

你可能感兴趣的:(tree)