Search code examples
javascripttreedrag-and-dropextjs4treenode

how to get value of a node where a leaf is dropped in a tree


I have a tree panel where a leaf can be dropped to a node. I want to get the value of that node where the leaf is dropped.

Doing this gets me the first node and not the node where I dropped the leaf

Ext.StoreMgr.lookup('myStore').tree.root.childNodes[0].get('nodeName')

I also tried

overModel.get('nodeName')

but this doesn't work when the node is expanded..


Solution

  • listeners: {
        drop: function(node, data, overModel, dropPosition,  dropFunction,  eOpts ){
             console.log(data.records[0].parentNode.data);//old parent 
             console.log( overModel.parentNode.data);//new parent
         } 
    }