I am trying to implement multilevel lazy loading treeview. We are not sure of how many levels of nodes will be there in the treeview.
1. ) How can i implement multiple levels of nodes ? i have X number of items and it is not possible for me to provide children always.
2. ) while creating my treeview data model i have an attribute "RANK" in the model. How do i get value of RANK for expanded node so that i can pass it as input while calling service to load child node?
For URL i need to add RANK as parameter. When i used url: function (options) { }) i am only getting ID value in options but not the RANK.
Below is the code i implemented for two levels.
Please help. If possible please provide an example.
Thanks in advance.
<div id="trVwScanOrg" ></div>
$(document).ready(function () {
TreeviewDataBind();
});
function TreeviewDataBind() {
var SecondLevel= {
transport: {
read: {
url: function (options) {
return kendo.format(MVC URL + parameters in querystring);
},
type: "get",
dataType: "json"
}
},
schema: {
model: {
id: "ID",
hasChildren: "HasChildren",
children: NextLevelItems,
Name: "Name"
}
}
};
var FirstLevel= new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: MVC URL + parameters in querystring
type: "get",
dataType: "json"
}
},
schema: {
model: {
hasChildren: "HasChildren",
id: "ID",
children: SecondLevel,
Name: "Name"
}
}
});
var trVwScanOrg = $("#trVwScanOrg").kendoTreeView({
dataSource: FirstLevel,
dataTextField: ["Name"]
});
}