PDA

View Full Version : [CLOSED] DragDrop Grid to Tree - treepanel re-ordering



Kev
Apr 16, 2013, 3:12 PM
In the example below, I can't seem to re-order the treepanel when combining with a drag and drop from a grid - I've tried tweaking the code but to no avail. Is there a simple way to do this? As it seems the combination of the draggroup and beforedrop event don't allow you to re-order the tree itself.

http://examples2.ext.net/#/DragDrop/Grid/Grid_to_Tree/

Any help would be appreciated.
Thank you,Kev

Baidaly
Apr 16, 2013, 9:53 PM
Hello!

Try to use the following:



<ext:TreeView runat="server">
<Listeners>
<AfterRender Delay="10" Handler="
this.plugins[0].dropZone.addToGroup('tree2grid')
"></AfterRender>
</Listeners>
<Plugins>
<ext:TreeViewDragDrop runat="server" DragGroup="tree2grid" DropGroup="grid2tree" NodeHighlightOnDrop="false" />
</Plugins>
<Listeners>
<BeforeDrop Fn="beforerecorddrop" />
</Listeners>
</ext:TreeView>


But you have to change BeforeDrop handlers.

Kev
Apr 17, 2013, 8:26 AM
Hello!

Try to use the following:



<ext:TreeView runat="server">
<Listeners>
<AfterRender Delay="10" Handler="
this.plugins[0].dropZone.addToGroup('tree2grid')
"></AfterRender>
</Listeners>
<Plugins>
<ext:TreeViewDragDrop runat="server" DragGroup="tree2grid" DropGroup="grid2tree" NodeHighlightOnDrop="false" />
</Plugins>
<Listeners>
<BeforeDrop Fn="beforerecorddrop" />
</Listeners>
</ext:TreeView>


But you have to change BeforeDrop handlers.

Hi Baidaly,
thanks for this, but I'm not sure what you mean "change BeforeDrop handlers"? Are you saying to change them to a handler? What would this achieve?

Also, the AfterRender listener worked (it allowed drag and drop), but the node contained blank text on drop and you could drop the node above the root node?

Cheers,
Kev

Daniil
Apr 17, 2013, 8:45 AM
Hi @Kev,


thanks for this, but I'm not sure what you mean "change BeforeDrop handlers"? Are you saying to change them to a handler? What would this achieve?


No, @Baidaly meant changing its logic to take dropping within the tree into account.

The difference between Fn and Handler is explained here.
http://www.ext.net/2012/12/19/introduction-to-ext-net-events/



Also, the AfterRender listener worked (it allowed drag and drop), but the node contained blank text on drop

I think it is why @Baidaly said that you must change the handlers.



you could drop the node above the root node?


To get two roots? Only the one root is possible. You can hide a root node if needed setting up RootVisible="false" for a TreePanel. Then a user will get a feel that he drops above the root, but, in affect, it will reordering of root children.