如何在节点下降后导致丢弃事件?

时间:2016-11-24 13:12:43

标签: extjs6

How to fires event after Drag & Drop on TreePanel

On an ExtJS drag and drop tree using the drop or beforedrop listeners dont seem to fire

How do I make an ExtJS drag and drop tree be copy only -- not remove items from the display?

我正在尝试移动已移动节点的新父级:

    drop: function (node, data, overModel, dropPosition) {
        var theNode = data.records[0];


        console.log( theNode.data.parentId );
        console.log( theNode.parentNode.id );

    }, 

但是:

注1:node参数不是真正的TreeNode,只是HTML标记。

注意2:theNode.parentNode未更新,我正在使用旧节点父节点(在拖动之前)。它将在drop功能之后更新。

如何将新节点设为父节点?

1 个答案:

答案 0 :(得分:0)

解决了(ExtJS 6.2.x)。

drop: function (node, data, overModel, dropPosition) {
    var thisIsTheMovedNode = data.records[0];
    var thisIsTheNewParentNodeData = overModel.data;
    var thisIsTheOldParentNodeData = data.records[0].parentNode;
}

新的父节点ID为:overModel.data.id;