求一个mvc4 + easyui tree 的实例

Ceramm 2015-07-29 03:01:56
如题:
mvc4 用ef链接 在控制器中返回得到的数据. 到前台转easyui-tree显示.

...全文
549 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
鼓嘚喵~ 2018-11-06
  • 打赏
  • 举报
回复
2830374159@qq.com 蟹蟹!
常熟老九 2017-04-05
  • 打赏
  • 举报
回复
273784828@qq.com 谢谢
yll002187 2017-04-05
  • 打赏
  • 举报
回复
同求morring@vip.qq.com
苏州吴彦祖 2017-02-20
  • 打赏
  • 举报
回复
引用 2 楼 qq5457237 的回复:
蛮好我没事做了个demo ,留下你的邮箱,骚年
同求 邮箱:331046212@qq.com
飘零雁 2017-02-17
  • 打赏
  • 举报
回复
http://blog.csdn.net/mochounv/article/details/55300390
uittle 2015-08-20
  • 打赏
  • 举报
回复
2楼 能把代码共享吗 数据库也要 我就是grid显示不出数据 uittle@163.com
本拉灯 2015-07-30
  • 打赏
  • 举报
回复
<div id="leftTree" style="background-color: #fff;"> <div class="panel-loading">加载中...</div> </div>

     function initTree()
     {
         $('#leftTree').tree({
             animate: false,
             checkbox: false,
             url: '/Home/TreeView',
             onClick: function (node) {
                 if (node.url != "") {
                     //addTab(node.text, node.url, node.icon); 点击节点
                 }
             },

         });
     }

生成JSON格式
  public static string GetMenu(List<TreeNode> list)
        {
            StringBuilder json = new StringBuilder();
           
            if (list.Count > 0)
            {
                json.Append("[");
                foreach (TreeNode dr in list)
                {
                    json.Append("{\"id\":" + dr.ID.ToString());
                    json.Append(",\"text\":\"" + dr.Text + "\"");
                    json.Append(",\"state\":\"open\"");
                    json.Append(",\"url\":\"" + dr.Url + "\"");
                    if (dr.Nodes.Count > 0)
                    {
                        json.Append(",\"children\":");
                        json.Append(GetMenu(dr.Nodes));
                    }
                    json.Append("},");
                }
                json.Remove(json.Length - 1, 1);
                json.Append("]");
            }
            return json.ToString();
        }




public class TreeNode
    {
        public int ID { get; set; }
        public string Text { get; set; }
        public string State { get; set; }
        public string Url { get; set; }
        public string Icon { get; set; }
        public List<TreeNode> Nodes { get; set; }


        public TreeNode()
            : this(string.Empty)
        {

        }

        public TreeNode(string text)
            : this(0, text, string.Empty, string.Empty)
        {

        }


        public TreeNode(int id,string text)
            : this(id, text, string.Empty, string.Empty)
        {

        }

        public TreeNode(string text, string url)
            : this(0, text, string.Empty, url)
        {



        }


        public TreeNode(int id,string text, string url)
            : this(id,text, string.Empty, url)
        {

        }

        public TreeNode(int id,string txt, string icon, string url)
        {
            this.ID = id;
            this.Text = txt;
            this.State = "open";
            this.Url = url;
            this.Icon = icon;
            Nodes = new List<TreeNode>();
        }
    }
jhdxhj 2015-07-30
  • 打赏
  • 举报
回复
关注下。我也在想办法解决。
qq5457237 2015-07-29
  • 打赏
  • 举报
回复
蛮好我没事做了个demo ,留下你的邮箱,骚年
syjml 2015-07-29
  • 打赏
  • 举报
回复
关注下。我也在想办法解决。
Ny-6000 2015-07-29
  • 打赏
  • 举报
回复
好事多磨啊. 慢慢来

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧