Esempio n. 1
0
        //递归子类
        private object GetChild <T>(List <T> treelist, int id, DelTreeAttr delTreeAttr)
        {
            List <WebTreeNode> wtnls = new List <WebTreeNode>();

            foreach (var au in treelist)
            {
                BaseTree bt = (BaseTree)(object)au;
                if (bt.FatherID != id)
                {
                    continue;
                }
                WebTreeNode wtn = new WebTreeNode
                {
                    id         = bt.Id,
                    iconCls    = bt.ImagePath,
                    text       = bt.NodeName,
                    state      = bt.State,
                    children   = GetChild(treelist, bt.Id, delTreeAttr),
                    attributes = delTreeAttr(au)
                };
                wtnls.Add(wtn);
            }
            return(wtnls);
        }
Esempio n. 2
0
        //初始化以easyui树的数据结构
        public List <WebTreeNode> InitTreeNode <T>(List <T> treelist, DelTreeAttr delTreeAttr, int fid = 0)
        {
            List <WebTreeNode> webTreeNodes = new List <WebTreeNode>();

            foreach (var tn in treelist)
            {
                BaseTree bt = (BaseTree)(object)tn;
                if (bt.FatherID != fid)
                {
                    continue;
                }
                WebTreeNode wtn = new WebTreeNode
                {
                    id         = bt.Id,
                    iconCls    = bt.ImagePath,
                    text       = bt.NodeName,
                    state      = bt.State,
                    children   = GetChild(treelist, bt.Id, delTreeAttr),
                    attributes = delTreeAttr(tn)
                };
                webTreeNodes.Add(wtn);
            }
            return(webTreeNodes);
        }