javascript - Kendo UI KendoTreeView HierarchicalDataSource not showing nodes -


my kendo ui treeview not getting returned json objects added treeview.

i can see controller method gets called json being given datasource looks (but more files , folders)

{"nodeid":-842352767, "name":"/", "folders":[{"nodeid":1804712307,"name":"/$recycle.bin","folders":null,"files":null},{"nodeid":-582712839,"name":"/windows","folders":null,"files":null}], "files":["/.rnd","/msdia80.dll"]}

my view follows:

@model projname.models.browsenode  <div id ="wrapper"> <h1>browser</h1> <div id="treeview" style="float:left;margin: 40px;"> </div> </div> <script> function populatetreeview() {     var remotedatasource = new kendo.data.hierarchicaldatasource({         type: "json",         transport: {             read: "filebrowser/gethierarchy"         },         schema: {             model: {                 id: "nodeid",                 text: "name",                 expanded: false,                 children: "folders",             },         }     });      $("#treeview").kendotreeview({         datasource: remotedatasource,         datatextfield: "name"     }); }  $(document).ready(function () {     populatetreeview(); }); 

with browsenode defined as:

public class browsenode {     public int nodeid {                  {             if (null == name)                 return default(int);             return name.gethashcode();            }     }     public string name { get; set; }     public list<browsenode> folders { get; set; }     public list<string> files { get; set; } } 

anything wrong or tips debugging sort of thing?

it turned out json wasn't datasource wanted. should have been array returned @ top level, json surrounded [ ] brackets follows:

[{"nodeid":-842352767, "name":"/", "folders":[{"nodeid":1804712307,"name":"/$recycle.bin","folders":null,"files":null},{"nodeid":-582712839,"name":"/windows","folders":null,"files":null}], "files":["/.rnd","/msdia80.dll"]}]


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -