예제 #1
0
        /// <summary>
        /// 添加节点
        /// </summary>
        /// <param name="root">树形数据传输对象</param>
        private void AddNodes(TreeDto root)
        {
            var rootNode = ToNode(root);

            _result.Nodes.Add(rootNode);
            AddChildren(rootNode);
        }
예제 #2
0
        /// <summary>
        /// 是否根节点
        /// </summary>
        /// <param name="dto">树形数据传输对象</param>
        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));
        }
예제 #3
0
        /// <summary>
        /// 转换为树节点
        /// </summary>
        /// <param name="dto">树形数据传输对象</param>
        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);
        }