I have a function that takes an id of a node, and expands the treeview so the node is showing. This is necessary as I need to refresh the treeview as items are added and edited.
I'm loading all the data in one go, from am AJAX call.
The code works when fired from a button, however I need it to be fired once the treeview data has finished loading. Unfortunately the onDataBound event seems to fire multiple times, depending on how many nodes the treeview contains. I did try using the datasource requestEnd event, however this seems to fire before the onDataBound events.
How can I detect that the treeview data has loaded, and the treeview is ready to have my expand function called?
The treeview definition is:-
@(Html.Kendo().TreeView() .Name("Treeview") .ExpandAll(false) .LoadOnDemand(false) .HtmlAttributes(new { style = "display: inline-block;" }) .DataTextField("Text") .Events(e => { e.DragStart("menuDragStart"); e.DataBound("onDataBound"); }) .DragAndDrop(true) .DataImageUrlField("ImageUrl") .DataSource(ds => ds .Model(m => m .Id("Id") .HasChildren("HasChildren") .Children("Items") ) .Events(e=>e.RequestEnd("requestEnd")) .Read(r => r.Action("GetMenuTreeItems", "Menu") ) ) .HtmlAttributes(new { style = "width:480px;height:600px;" }) )Thanks
