Example #1
0
        /// <summary>
        /// 添加节点
        /// </summary>
        private void AddNodes(TreeDto root)
        {
            var rootNode = ToNode(root);

            _result.Nodes.Add(rootNode);
            AddChildren(rootNode);
        }
Example #2
0
 /// <summary>
 /// 是否根节点
 /// </summary>
 protected virtual bool IsRoot(TreeDto dto)
 {
     if (_data.Any(t => t.ParentId.IsEmpty()))
     {
         return(dto.ParentId.IsEmpty());
     }
     return(dto.Level == _data.Min(t => t.Level));
 }
Example #3
0
        /// <summary>
        /// 转换为树节点
        /// </summary>
        protected virtual ZorroTreeNode ToNode(TreeDto dto)
        {
            var result = new ZorroTreeNode {
                Key             = dto.Id,
                Title           = dto.Text,
                Icon            = dto.Icon,
                Disabled        = !dto.Enabled.SafeValue(),
                Expanded        = dto.Expanded.SafeValue(),
                Checked         = dto.Checked.SafeValue(),
                DisableCheckbox = dto.DisableCheckbox.SafeValue(),
                Selectable      = dto.Selectable.SafeValue(),
                Selected        = dto.Selected.SafeValue()
            };

            InitIsLeaf(result);
            return(result);
        }