-
17 May 2012 3:58 AM #1
How to set default drop in TreePanel to always be "root" node?
How to set default drop in TreePanel to always be "root" node?
What I have is 2xTreePanel with drag & drop controls.
Now my idea is to prevent users from dropping the tree nodes anywhere else except on the root node.
I have managed to get around that problem by using a listener.
Example.
This works well but is there not a more effective solution. For example set the root node to "root" if it's not the root?Code:listeners: { beforedrop: function(node, data, overModel, dropPosition, dropFunction, eOpts ) { if ( !overModel.isRoot() ) { Ext.example.msg('<p style="color:red;"><b>Error on Drop</b></p>', 'Please drop data on top only'); return false; } }
That means I can allow drop of data anywhere and it will always display correctly.
Thanks for all the help.
-
30 May 2012 9:18 AM #2
Can I get you to clarify your intention. I am not sure what you mean in your 'root' statement.
Scott.
-
30 May 2012 11:01 PM #3
Hey,
Example.PNG
Here I have a drag drop in 2 tree views.
What I mean about the "root" nodes it will be "Available" and "Selected" node.
So if you drag and drop from left to right and yo don't drop it on "Selected" node it will give you an error message plus move the node back to "Available"
But I want to user to be able to drop the selection anywhere on the right hand side, even in the white space and it will automatically accept and display it as if you dropped it on "Selected" root node.
Hope this explains my issue better.
Riaan
-
3 Jun 2012 2:52 PM #4
Are you referring to something like allowContainerDrop
Scott.
-
3 Jun 2012 9:57 PM #5
Partially yes.
allowContainerDrop is suppose to allow me to drop in the white space. ( Does not always work )
But eventually should I drag "MARINERS_MINE" from the top picture on the left and drop it into the white space on the right.
Then it should automatically pick up that it was not dropped on "Selected" node and change "MANIRERS_MINE" root node to "Selected" and display it as the picture indicate below.
Capture.PNG
Riaan


Reply With Quote