C#/ JQUERY:在JSTree中加载节点

问题描述

我开始致力于让JSTree与我的Web应用一起工作。我使用了各种教程和其他人的问题来使此工作正常。我一直在使用此tutorial,并且得到了用于输出“正在加载...”和微调轮的树。

enter image description here

我正在使用其他JSON格式作为数据格式。我有一个名为jsTreeNode的类,它具有三个属性(id,parent,text)。

JS代码

$(document).ready(function () {
            
            $('#folderTree').jstree({
                'plugins': ["defaults"],'core': {
                    'data': {
                        "themes": {
                            "responsive": true
                        },"url": "photoapp.asmx/CreateFolderStructure","dataType": "json"
                    }
                }
            });
        });

ASP.NET

  [WebMethod]
        [ScriptMethod(UseHttpGet = true)]
        public string CreateFolderStructure()
        {
            try
            {
                List<jsTreeNode> root = new List<jsTreeNode>();
                jsTreeNode oFolder = new jsTreeNode();
                oFolder.id = Guid.NewGuid().ToString();
                oFolder.parent = "#";
                oFolder.text = "Folder 1";
                root.Add(oFolder); 
                return (new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(root));
            }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)