I am using Kendo UI TreeView to load hierarchical data in my webpage. By default, I am loading data upto 3 levels (ie Root -> Root directs -> Root directs' directs). I need a way to lazily load the remaining nodes as user expands further down the tree. Also, the already fetched data must be cached locally to avoid unnecessary calls for already expanded nodes. I am new to Kendo UI and do not have enough time to go through documentation. The json looks like
{
Id: '1',
ParentId: '-1',
Payload: {... }
Children: [
Id: '2',
ParentId: '1',
PayLoad: {...},
Children: [{...}]
]
....
}
Can someone point out to code samples ? How much of the above is supported out of box by Kendo ?
Thanks in advance.
After some more work, I got this to work. I'm still not sure why the localData variable is needed, since the Kendo treeview doesn't seem to use it once a node is already in there. Here's my solution anyhow:
I'm using a stored procedure to read values from 3 tables into a Tree object. Here is the code for the Tree object:
And my Stored procedure:
AS BEGIN SET NOCOUNT ON;
END
That functionality is not supported by the out of the box configuration, but can be achieved through a custom transport. Here's how to create hybrid data sources that work with the
localData
array if the items are available, and otherwise perform requests to the server.