Hello,
I am trying to implement a TreeView using remote binding. My datasource Id property is actually a string not an integer - I am having trouble getting this working - can you advise where I am going wrong? My code is below.
Thanks,
Carrie
View
Controller
I am trying to implement a TreeView using remote binding. My datasource Id property is actually a string not an integer - I am having trouble getting this working - can you advise where I am going wrong? My code is below.
Thanks,
Carrie
View
@(Html.Kendo().TreeView()
.Name("treeviewTierQueue")
.DataTextField("Text")
.DataSource(dataSource => dataSource
.Read(read => read.Action("GetTierQueueList", "Enum"))
))
public JsonResult GetTierQueueList(string level)
{
var items = new List<
NestedSelectListItem
>()
{
new NestedSelectListItem {Id = "0", Text = "All Analysts"},
new NestedSelectListItem {Id = "1", Text = "All Groups"},
new NestedSelectListItem {
Id = "2",
Text = "Service Desk",
hasChildren=true,
Items = new List<
NestedSelectListItem
> ()
{
new NestedSelectListItem {Id = "2a", Text = "2nd Level"},
new NestedSelectListItem {Id = "2b", Text = "2nd Level B"},
new NestedSelectListItem {
Id = "2c",
Text = "2nd Level C",
hasChildren= true,
Items = new List<
NestedSelectListItem
> ()
{
new NestedSelectListItem {Id = "3a", Text = "3rd Level"},
new NestedSelectListItem {Id = "3b", Text = "3rd Level B"}
}
} } }
};
if (!String.IsNullOrEmpty(level))
{
var filtered = items.First(i => i.Id == level).Items;
items = filtered;
}
return Json(items.AsEnumerable(), JsonRequestBehavior.AllowGet);
}