我有这个函数来捕获剑道树视图的拖动结束事件
function onDragEnd(e) { console.log("Drag end", e.sourceNode, e.dropPosition, e.sourceNode); }
这将显示整个节点数据,例如
还有这个函数来获取节点的文本.
var text = this.text(e.sourceNode);
我希望有类似的东西
var id = this.id(e.sourceNode);
会工作,但它没有,
树视图
$("#treeView").kendoTreeView({ dragAndDrop: true, dataSource: treeViewDataSource, dataTextField: "Name", dragend: function(e) { var tree = $(#treeView).data("kendowTreeview"); /* tree.dataItem accesses the item's model. You will be able to access any field declared in your model*/ var movingItem = tree.dataItem(e.sourceNode); var destinationItem = tree.dataItem(e.destinationNode); /*Using firebug, console.log(movingItem) will elaborate better as to what you have access in the object*/ var movingItemID = movingItem.id; var destinationItemID = destinationItem.id; //Get the same ID by movingItemID.MyID //(if id:"MyID" set in dataSource's schema) } });