Hey all I am having an issue with Kendo UI for ASP.net MVC with a mix of jQuery thrown in there for data retrieval.
My current treeview looks like this:
However, I am wanting it to look more like this:
My JSON structure that I have to work with looks like this:
{
"meta": {
"total_results": 193,
"offset": 0,
"total_pages": 1
},
"object_list": [{
"Name": "facebook",
"Description": null,
"Id": "eb8cb0c8c32d1201bff30cf54S4f30889abb23f92b1f7",
"DocumentType": null,
"ProviderId": 2,
"Cat": "Social Networks"
}, {
"Name": "twitter",
"Description": null,
"Id": "732fe66cce4365bc5074384f09b34e787f3f3efe8b55",
"DocumentType": null,
"ProviderId": 2,
"Cat": "Social Networks"
}, {
"Name": "Google",
"Description": null,
"Id": "8b11d6f7b74bf71a7ddbc62dcfead27087e0f3e047e",
"DocumentType": null,
"ProviderId": 2,
"Cat": "Search Engines"
}, {
...ETC...
Which looks like it needs to be formatted to look like this:
$("#treeview").kendoTreeView({
checkboxes: {
checkChildren: true
},
check: onCheck,
dataSource: [{
id: 1, text: "Categories", expanded: true, spriteCssClass: "rootfolder", items:
[{
id: 2, text: "Social Networks", expanded: true, spriteCssClass: "folder",
items: [
{ id: 3, text: "facebook", spriteCssClass: "html" },
{ id: 4, text: "twitter", spriteCssClass: "html" },
{ id: 5, text: "WhatsApp", spriteCssClass: "image" },
{ id: 6, text: "instagram", spriteCssClass: "image" },
{ id: 7, text: "wechat", spriteCssClass: "image" }
]}, {
id: 8, text: "Search Engines", expanded: true, spriteCssClass: "folder",
items: [
{ id: 9, text: "Google", spriteCssClass: "image" },
{ id: 10, text: "Yahoo!", spriteCssClass: "pdf" }
]}
]
}]
});
So my question - how do I get it into the correct treeview structure format like above since I am unable to modify the JSON that's being sent to me? Ether soluction (JQuery or ASP.net MVC) will be fine.
Any help would be great!
update



Good news is that you actually CAN change the Api data using
dataSource.schema.parseevent:Dojo