Reputation: 271
I am setting up a custom drag and drop implementation with treepanels, where I want all nodes to attach to a node I have created under the root. I am trying to drag one node from one treepanel to the other in a certain way. I am able to move the item over, but run into trouble when removing it from the other side.
Here is my code, this is within my treepanel:
viewConfig:{
plugins:{
ptype:'treeviewdragdrop',
DDgroup:'treeDD'
},
listeners:{
beforedrop: function(node, data, dropRec, dropPosition){
if(dropRec.parentNode.data.text == "Root"){
console.log('dropping on top level');
this.up('panel').getStore().getRootNode().getChildAt(0).insertChild(0, data.records[0].data);
//the below line seems to be causing the error, how should I be removing?
choicesTree.getRootNode().getChildAt(0).removeChild(data.records[0]);
//choicesTree is previously defined
return false;
}
}
This manages to removed the item from the first treepanel, but immediatly gives the following error:
item is null
fly(item.firstChild).highlight(me.repairHighlightColor, {
Upvotes: 1
Views: 1461
Reputation: 271
The return false is causing the issue in the code. return 0 also doesn't work as the docs describe. The code is not working due to bugs in version 4.07 of extjs the code works as expected in version 4.1
From the documentation: Returning false to this event signals that the drop gesture was invalid, and if the drag proxy will animate back to the point from which the drag began. Returning 0 To this event signals that the data transfer operation should not take place, but that the gesture was valid, and that the repair operation should not take place. Any other return value continues with the data transfer operation.
The above behavior from the docs is different from what occurs
Upvotes: 1