I'm biding a treeview to a remote data and at this point the data is displayed correctly. The problem: when I change the data in the database and refresh my page, the treeview doesn't reflect the new data. It seems that the treeview is not calling the json action anymore after the first load.
I tried to work with LoadOnDemand and several other methods, but nothing worked so far. I need to refresh the data because when users drag and drop the nodes, the treeview will be updated in the database.
** Code is attached. I also just noticed that it works on Chrome but not IE 10. Thank you for any help.
I'm following this demo code: http://demos.kendoui.com/web/treeview/remote-data.html
This is my json action:
public JsonResult Categories(int? id)
{
var categories = from e in db.Categories
where (id.HasValue ? e.ParentCategoryID == id : e.ParentCategoryID == 1)
orderby(e.OrderNumber)
select new
{
id = e.CategoryID,
Name = e.CategoryNames.FirstOrDefault().Name,
ParentId = e.ParentCategoryID,
hasChildren = db.Categories.Where(j => j.ParentCategoryID == e.CategoryID).Any()
}
;
return Json(categories, JsonRequestBehavior.AllowGet);
}
This is my treeview code:
Html.Kendo().TreeView()
.Name("treeviewcategories")
.DataTextField("Name")
.DataSource(dataSource => dataSource
.Read(read => read
.Action("Categories", "Settings")
)
)
.Events(events => events
.Select("onSelect")
.DragEnd("onDragEnd")
.Expand("onExpand")
)
.DragAndDrop(true)
I tried to work with LoadOnDemand and several other methods, but nothing worked so far. I need to refresh the data because when users drag and drop the nodes, the treeview will be updated in the database.
** Code is attached. I also just noticed that it works on Chrome but not IE 10. Thank you for any help.
I'm following this demo code: http://demos.kendoui.com/web/treeview/remote-data.html
This is my json action:
public JsonResult Categories(int? id)
{
var categories = from e in db.Categories
where (id.HasValue ? e.ParentCategoryID == id : e.ParentCategoryID == 1)
orderby(e.OrderNumber)
select new
{
id = e.CategoryID,
Name = e.CategoryNames.FirstOrDefault().Name,
ParentId = e.ParentCategoryID,
hasChildren = db.Categories.Where(j => j.ParentCategoryID == e.CategoryID).Any()
}
;
return Json(categories, JsonRequestBehavior.AllowGet);
}
This is my treeview code:
Html.Kendo().TreeView()
.Name("treeviewcategories")
.DataTextField("Name")
.DataSource(dataSource => dataSource
.Read(read => read
.Action("Categories", "Settings")
)
)
.Events(events => events
.Select("onSelect")
.DragEnd("onDragEnd")
.Expand("onExpand")
)
.DragAndDrop(true)