PDA

View Full Version : [FIXED] Where did Tree event "nodedragover " go?



andrej_marincic
14 Jun 2011, 2:10 AM
Hello,

I want to use drag - drop functionallity of Tree, but there seems "nodedrageover" Tree event is missing.
I need this to check if drop zone is valid.

I looked at VieWDropZone.js file and saw that function "isValidDropPoint" does not fire event "nodedrageover" like the same function in ExtJS 3.4 does :s

Will this be fixed?

best regards

andrej_marincic
17 Jun 2011, 2:33 AM
Hello anyone has the same problem, or is it just me? :-)

Priet
17 Jun 2011, 5:00 AM
I don't have an answer to your problem. But you're not the only one running into problems with the tree. It seems that the 'old' Ext 3.x tree was far superior to the current implementation of the tree in Ext 4 :(

For example:



TreePanel: callback beforeselect and beforeitemclick do not work like in V3 (http://www.sencha.com/forum/showthread.php?131827-TreePanel-callback-beforeselect-and-beforeitemclick-do-not-work-like-in-V3)
Refresh node in tree panel (http://www.sencha.com/forum/showthread.php?133372-Refresh-node-in-tree-panel)
[Ext4-Tree] How to get path on tree node. (http://www.sencha.com/forum/showthread.php?134269-Ext4-Tree-How-to-get-path-on-tree-node.)

It's a shame, really :(

cadror
17 Jan 2013, 12:03 PM
According to the API docs (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.tree.View-event-nodedragover), the nodedragover event is only available since Ext 4.1.2. However, that version hasn't been released as GPL yet, so I've been forced to rely on the private isValidDropPoint() method (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.tree.ViewDropZone-method-isValidDropPoint) to construct a workaround, as follows.

Add an afterrender event handler to your TreeView (which contains a TreeViewDragDrop plugin (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.tree.plugin.TreeViewDragDrop) as its first plugin) like this:



function(abstractcomponent, options) {
var targetView = abstractcomponent;
var targetZone = targetView.plugins[0].dropZone;

// FIXME: isValidDropPoint() is a private method in Ext 4.1.1a
// so move this code into a treeview#nodedragover event handler
// once Ext 4.1.2 is released under the GPL for open source usage
//
var overridden = targetZone.isValidDropPoint;
targetZone.isValidDropPoint = function(targetNode, dropPosition, dragZone, dragEvent, dragData) {
if (overridden.apply(this, arguments)) {
var targetModel = targetView.getRecord(targetNode);
var sourceModel = dragData.records[0];

// TODO: your stuff here... return true if you want to allow the drop
}
return false;
}
}


Cheers!