I need a TreeView example for ASP.NET Core 2.2 that uses Binding and shows me how I can capture the drag/drop events from the control with some context information. Your example shows that it can be done but I see no way to capture the data item that is bound to the node or even wire up a KeyValue to a node so when it is clicked that I have a breadcrumb back to my data store.
I appreciate your help,
Joel
My current TreeView:
Html.Kendo().TreeView() .TemplateId("treeview-template") .DragAndDrop(true) .Name("kendoTreeView") .Events(events => events .Change("onChange") .Select("onSelect") .Drop("onDrop") .DragEnd("onDragEnd") ) .BindTo(Model, (NavigationBindingFactory<TreeViewItem> mappings) => { mappings.For<Group>(binding => binding.ItemDataBound((item, group) => { item.Text = group.Name; item.Id = $"{group.Id}"; item.ImageUrl = group.ImageUrl; item.Expanded = true; }) .Children(group => group.Children)); }) )<script> var treeview; function onSelect(e) { alert(e.node); } function onChange(e) { alert(e.node); } function onDrop(e) { alert(e.node); } function onDragEnd(e) { alert(e.node); } $(document).ready(function() { treeview = $("#treeview").data("kendoTreeView"); });</script>
