{"action":"created","issue":{"url":"https://api.github.com/repos/mbraak/jqTree/issues/405","labels_url":"https://api.github.com/repos/mbraak/jqTree/issues/405/labels{/name}","comments_url":"https://api.github.com/repos/mbraak/jqTree/issues/405/comments","events_url":"https://api.github.com/repos/mbraak/jqTree/issues/405/events","html_url":"https://github.com/mbraak/jqTree/issues/405","id":114068185,"number":405,"title":"JSON data returned by the Controller is shown as raw data, instead of in jqTree","user":{"login":"faujong","id":15381859,"avatar_url":"https://avatars.githubusercontent.com/u/15381859?v=3","gravatar_id":"","url":"https://api.github.com/users/faujong","html_url":"https://github.com/faujong","followers_url":"https://api.github.com/users/faujong/followers","following_url":"https://api.github.com/users/faujong/following{/other_user}","gists_url":"https://api.github.com/users/faujong/gists{/gist_id}","starred_url":"https://api.github.com/users/faujong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faujong/subscriptions","organizations_url":"https://api.github.com/users/faujong/orgs","repos_url":"https://api.github.com/users/faujong/repos","events_url":"https://api.github.com/users/faujong/events{/privacy}","received_events_url":"https://api.github.com/users/faujong/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-29T14:58:30Z","updated_at":"2015-10-29T18:53:51Z","closed_at":null,"body":"I would like to show the JSON data in the jqTree (\r\nhttp://weblogs.asp.net/jdanforth/lazy-loading-treeview-sample-with-asp-net-mvc-and-jqtree)\r\n\r\nI am using Visual Studio 2012.\r\nMy in HomeController.cs, I have a method \"ActionResult Nodes\" that return a JSON string.\r\nI associated that method with a View \"Nodes.cshtml\" (in Visual Studio, when I right click on this method in HomeController.cs and select \"Go to View\", it does go to the View \"Nodes.cshtml\".\r\n\r\nThis is on _Layout.cshtml:\r\n<li>@Html.ActionLink(\"Node\", \"Nodes\", \"Home\")</li>\r\n\r\nNo matter how I change \"Nodes.cshtml\", when I click on the menu \"Node\", the raw JSON data is printed in the browser, ie\r\n[{\"label\":\"SubFolder1\",\"id\":\"C:/MyFolder/SubFolder1\",\"load_on_demand\":true},{\"label\":\"batch.txt\",\"id\":\"C:/MyFolder/batch.txt\",\"load_on_demand\":false},\r\n:\r\nWhat causes this, and how can I fix it ?\r\n\r\nHomeController.cs\r\npublic ActionResult Nodes(string node)\r\n        {\r\n            var list = new List<Node>();\r\n                var items = Directory.GetFileSystemEntries(\"C:/MyFolder/\");\r\n                foreach (var item in items)\r\n                {\r\n                    list.Add(new Node(Path.GetFileName(item), item, Directory.Exists(item)));\r\n                }\r\n            return Json(list, JsonRequestBehavior.AllowGet);\r\n        }\r\n\r\nView \"Nodes.cshtml\" using jqTree (http://weblogs.asp.net/jdanforth/lazy-loading-treeview-sample-with-asp-net-mvc-and-jqtree)\r\n@model MVCTreeView.Models.Node\r\n\r\n@{\r\n    ViewBag.Title = \"Nodes\";\r\n}\r\n\r\n<h2>Nodes</h2>\r\n<div id=\"tree1\" data-url=\"/home/nodes\"></div>\r\n\r\n@section scripts {\r\n        @Styles.Render(\"~/Content/treecss\")\r\n        @Scripts.Render(\"~/bundles/tree\")\r\n    <script type=\"text/javascript\">\r\n        $(function () {\r\n            $('#tree1').tree({\r\n                closedIcon: $('<i class=\"fa fa-plus\"></i>'),\r\n                openedIcon: $('<i class=\"fa fa-minus\"></i>'),\r\n                dragAndDrop: false,\r\n                selectable: false\r\n            });\r\n\r\n            // bind 'tree.click' event\r\n            $('#tree1').bind(\r\n                'tree.click',\r\n                function (event) {\r\n                    // The clicked node is 'event.node'\r\n                    var node = event.node;\r\n                    console.log('clicked ' + node.name );\r\n                }\r\n            );\r\n        });\r\n    </script>\r\n}\r\n"},"comment":{"url":"https://api.github.com/repos/mbraak/jqTree/issues/comments/152285972","html_url":"https://github.com/mbraak/jqTree/issues/405#issuecomment-152285972","issue_url":"https://api.github.com/repos/mbraak/jqTree/issues/405","id":152285972,"user":{"login":"mbraak","id":235558,"avatar_url":"https://avatars.githubusercontent.com/u/235558?v=3","gravatar_id":"","url":"https://api.github.com/users/mbraak","html_url":"https://github.com/mbraak","followers_url":"https://api.github.com/users/mbraak/followers","following_url":"https://api.github.com/users/mbraak/following{/other_user}","gists_url":"https://api.github.com/users/mbraak/gists{/gist_id}","starred_url":"https://api.github.com/users/mbraak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbraak/subscriptions","organizations_url":"https://api.github.com/users/mbraak/orgs","repos_url":"https://api.github.com/users/mbraak/repos","events_url":"https://api.github.com/users/mbraak/events{/privacy}","received_events_url":"https://api.github.com/users/mbraak/received_events","type":"User","site_admin":false},"created_at":"2015-10-29T18:53:51Z","updated_at":"2015-10-29T18:53:51Z","body":"That is strange. I see that you set `autoOpen` to `0`. That should only open the main levels.\r\n\r\nI will try to reproduce this."}}