-
31 Jan 2013 3:45 AM #1
Answered: get the new 'parentNode' when using 'treeviewdragdrop'
Answered: get the new 'parentNode' when using 'treeviewdragdrop'
If a user is drag a node to a folder (parent) I try to get is new parent ID with the event 'DROP'.
The problem is that if the folder is not render I'm getting from:
node.parentNode.internalId
The main root of the tree.
But if I'm using "setTimeout" I'm getting is new parent ID.
This is what I have now, and I don't want to use the 'timeout', what option do I have:
Code:listeners: { 'drop': {fn:function( node, data, overModel, dropPosition, eOpts ){ var moveID ; var movePreviousSibling ; var moveNextSibling ; var moveParentNode ; node = data.records[0]; if (node) moveID = node.internalId ; //Disable all the tree Ext.getCmp('treePagesList').disable(); setTimeout(function(){ //Get all the detail of is new position node = Ext.getCmp('treePagesList').getStore().getNodeById(moveID); if (node.previousSibling) movePreviousSibling = node.previousSibling.internalId ; if (node.nextSibling) moveNextSibling = node.nextSibling.internalId ; if (node.parentNode) moveParentNode = node.parentNode.internalId ; }, 500); }, scope:this} }
-
Best Answer Posted by Arg0n
You could modify the Ext.tree.ViewDropZone class (source). There you have a function named: handleNodeDrop
When the function finished adding the new node, you could fire an event:
I made my own treeviewdragdrop plugin for that. It's the same plugin, it just uses my modified version of Ext.tree.ViewDropZone.Code:view.fireEvent('afternodedrop', node);
-
7 Feb 2013 12:33 AM #2
Can someone can help me here please?
I really like to know if there is any option do use more event like 'drop' that working Better.
-
7 Feb 2013 1:26 PM #3
You could modify the Ext.tree.ViewDropZone class (source). There you have a function named: handleNodeDrop
When the function finished adding the new node, you could fire an event:
I made my own treeviewdragdrop plugin for that. It's the same plugin, it just uses my modified version of Ext.tree.ViewDropZone.Code:view.fireEvent('afternodedrop', node);
-
24 Feb 2013 10:01 PM #4


Reply With Quote