jquery - Bind remote JSON Data to a Kendo TreeView - only getting first tier -


i'm trying kendo treeview display json data.

var treeviewdatasource = new kendo.data.hierarchicaldatasource({         transport: {             read: {                 url: "/utilities/tool/get/treeview",                 type: "get",                 datatype: "json"             }         }     });      $("#tree-view").kendotreeview({         loadondemand: false,         datasource: treeviewdatasource,         select: onselect     }); 

where json data looks this:

[{     "text": "create",     "description": "create transaction",     "items": [         {             "text": "pseudo",             "feature": "create",             "items": [                 {                     "text": "fix",                 }             ],             "nodechildren": 1         }     ],     "nodechildren": 1 }, {     "text": "data",     "description": "data report",     "items": [],     "nodechildren": 0 }] 

now, weird part if copy , paste above json data kendo datasource instead of calling remotely, treeview displays data fine. when call data remotely instead, treeview display first tier of nodes , looks this:

create

data

for brief second while table loading, little arrows designate whether node has children visible, these disappear. i'm not sure what's going on , kendo documentation not helpful. why kendo not reading data properly? i'm using postman test api , json looks fine me, , works if copied in locally. gives?

thanks

i've found solution problem, had mess schema, although still don't understand what/how schema works.

var treeviewdatasource = new kendo.data.hierarchicaldatasource({         transport: {             read: {                 url: "/utilities/tool/get/treeview",                 type: "get",                 datatype: "json"             }         },         schema: {             model: {                 children: "items"               }         }     }); 

all had define children field.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -