Example #1
0
        public sealed override void SetUp(object uiControl)
        {
            Row.EnsureHierarchicalSource(ref dataSource, Configuration.Current.Rows, Configuration.Current.Levels);
            base.SetUp(uiControl);
            // Columns
            treeList.BeginUpdate();
            var columns = HierarchicalRow.GetHierarchicalColumns();

            for (int i = 0; i < columns.Length; i++)
            {
                treeList.Columns.AddVisible(columns[i]);
            }
            treeList.Columns["ParentID"].Visible = false;
            treeList.EndUpdate();
        }
Example #2
0
            public sealed override void SetUp(object uiControl)
            {
                Row.EnsureHierarchicalSource(ref dataSource, Configuration.Current.Rows, Configuration.Current.Levels);
                base.SetUp(uiControl);
                // Columns
                treeList.BeginUpdate();
                treeList.OptionsBehavior.ExpandNodesOnFiltering = true;
                var columns = HierarchicalRow.GetHierarchicalColumns();

                for (int i = 0; i < columns.Length; i++)
                {
                    treeList.Columns.AddVisible(columns[i]);
                }
                treeList.Columns["ParentID"].Visible = false;
                treeList.EndUpdate();
                // Data
                treeList.BeginUnboundLoad();
                IDictionary <int, TreeListNode> nodes = new Dictionary <int, TreeListNode>();

                for (int i = 0; i < dataSource.Count; i++)
                {
                    var          data = dataSource[i].GetHierarchicalData();
                    int          parentID = dataSource[i].ParentID;
                    TreeListNode parentNode, node;
                    if (!nodes.TryGetValue(parentID, out parentNode))
                    {
                        node = treeList.AppendNode(data, dataSource[i].ParentID);
                    }
                    else
                    {
                        node = treeList.AppendNode(data, parentNode);
                    }
                    nodes.Add(node.Id, node);
                }
                treeList.ExpandAll();
                treeList.EndUnboundLoad();
                treeList.ClearColumnsFilter();
            }