zoukankan      html  css  js  c++  java
  • advtree复制选中项

    public static void CopySelectTree(DevComponents.AdvTree.NodeCollection n1, DevComponents.AdvTree.NodeCollection n2) { n2.Clear(); List> list = null; GetSelect(n1, ref list); for (int i = 0; i < list.Count; i++) { List list2 = list[i]; foreach (DevComponents.AdvTree.Node _nd in list2) { DevComponents.AdvTree.Node[] node3 = n2.Find(_nd.Name, true); if (node3.Length == 0) { if (_nd.Parent == null) { n2.Add(CreateNode(_nd.Name, _nd.Text, _nd.Tag, _nd.Checked)); } else { DevComponents.AdvTree.Node[] node4 = n2.Find(_nd.Parent.Name, true); if (node4.Length > 0) { node4[0].Nodes.Add(CreateNode(_nd.Name, _nd.Text, _nd.Tag, _nd.Checked)); } } } } } } public static DevComponents.AdvTree.Node CreateNode(string _name, string _text, object tag, bool b = false) { DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node(); node.CheckBoxVisible = true; node.Name = _name; node.Text = _text; node.Checked = b; node.Tag = tag; return node; } public static DevComponents.AdvTree.Node CreateNode(DevComponents.AdvTree.Node _node) { DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node(); node.CheckBoxVisible = _node.CheckBoxVisible; node.Name = _node.Name; node.Text = _node.Text; node.Checked = _node.Checked; node.Tag = _node.Tag; return node; } public static void GetSelect(DevComponents.AdvTree.NodeCollection n1, ref List> list) { if (list == null) { list = new List>(); } for (int i = 0; i < n1.Count; i++) { if (n1[i].Checked) { List list2 = GetParent(n1[i]); list.Add(list2); } GetSelect(n1[i].Nodes, ref list); } } public static List GetParent(DevComponents.AdvTree.Node node) { List list = new List(); list.Add(CreateNode(node)); while (node.Parent != null) { node = node.Parent; list.Add(CreateNode(node)); } list.Reverse(); return list; } 使用方法 DevComponents.AdvTree.NodeCollection nodes = new NodeCollection(); CopySelectTree(advTree_2019.Nodes, nodes);
  • 相关阅读:
    Laravel Passport token过期后判断refresh_token是否过期
    js 数组随机排序
    jquery的animate关于background-position属性
    css hack 汇整
    顶部导航--向上滚动的时候出现,向下滚动的时候隐藏
    手机端全局样式表整理(mobile)
    AR专用汉明码
    css常用命名规则
    晚11点
    当 IDENTITY_INSERT 设置为 OFF 时,不能为表‘XXX’中的标识列插入显式值。
  • 原文地址:https://www.cnblogs.com/mycls/p/10738816.html
Copyright © 2011-2022 走看看