I've assigned an ID attribute to each of my tree nodes to keep a hold of information I need on the controller so that I can save a modified Hierarchy.
However, when I drop a node, the Id attribute is removed. I'm not sure if this is a bug, if I'm doing something wrong, or this is working as intended by the developers.
I've attached a screenshot of my alert window (code below), and two shots of the Html generated from Firebug. One is before the Drop and one is from after.
However, when I drop a node, the Id attribute is removed. I'm not sure if this is a bug, if I'm doing something wrong, or this is working as intended by the developers.
I've attached a screenshot of my alert window (code below), and two shots of the Html generated from Firebug. One is before the Drop and one is from after.
@(Html.Kendo().TreeView()
.Name("CompanyHierarchy")
.Events(events => events
.DragEnd("HierarchyDragEnd")
)
.BindTo(Model.Hierarchy as System.Collections.IEnumerable, mappings =>
{
mappings.For<
BlueGrace.BlueShip.MVC.Models.EnterpriseChildModel
>(binding => binding
.Children(c => c.Children)
.ItemDataBound((item, c) =>
{
item.Text = c.Name;
item.HtmlAttributes.Add("Id", c.EnterpriseID.ToString() + "|" + c.EnterpriseID.ToString());
})
);
})
.DragAndDrop(true)
)
<
script
>
function HierarchyDragEnd(e) {
setTimeout(function () {
var originNode = e.sourceNode.id;
var destinationNode = e.destinationNode.id;
var loc = e.dropPosition;
alert("Origin ID: " + originNode + "\nDestination ID: " + destinationNode + "\nDrop Position: " + loc);
}, 100);
}
</
script
>