[Users] TR: Enabling drag n drop in the Ext.tree.TreePanel(enableDD)
Francesco D'Alesio
francesco.dalesio at r3-gis.com
Tue Feb 19 12:25:32 CET 2013
Hello François,
thank you for sharing this code. It works!
I need now to allow dragging only when the dragged record and the target
record share the same parent (no dragging outside the layer's group).
It seems that the code you described will solve my problem.
Could you please paste it? :)
Thank you
Regards,
Francesco
Il 18/02/2013 15:32, Valiquette,Francois [Montreal] ha scritto:
> Hello,
>
> As promised I give you the code I made to make drag and drop change the layer order of the nodes that are not using an GeoExt.tree.LayerContainer
>
> var indexVariation;
>
> node.addListener('beforemove', function (tree, thisNode, oldParent, newParent, index) {
> oldIndex = oldParent.indexOf(thisNode);
> });
>
> node.addListener('move', function (tree, thisNode, oldParent, newParent, index) {
> indexVariation = oldIndex - oldParent.indexOf(thisNode);
> map.raiseLayer(thisNode.layer, indexVariation);
> );
>
>
>
> Furthermore, my code let users add multiple WMS servers. Each WMS server make a new child in the root tree node and then, the newly created tree node contains all the layers of the WMS server. Also, users are allowed to drag and drop layers but only within the same parents. Also, parents can be dragged to change the drawing order of the server, but they cannot be dragged inside another node.
>
> If anyone is interested of getting the code, just reply to this email and I'll copy/pate it.
>
>
> François
>
>
>
> -----Message d'origine-----
> De : Valiquette,Francois [Montreal]
> Envoyé : 8 février 2013 13:56
> À : 'Julien-Samuel Lacroix'; users at geoext.org
> Objet : RE: [Users] TR: Enabling drag n drop in the Ext.tree.TreePanel(enableDD)
>
> Hello Julien,
>
> Thank you for your help, you almost remembered everything :)
>
> The function you were talking about is in LayerLoader.js and it is onChildMove
>
> I wrote up my own code since I manually create my own node. It was really simple. Next week, I will post my final function that will enable layers reordering between multiple WMS servers.
>
> François
>
> -----Message d'origine-----
> De : users-bounces at geoext.org [mailto:users-bounces at geoext.org] De la part de Julien-Samuel Lacroix
> Envoyé : 5 février 2013 14:36
> À : users at geoext.org
> Objet : Re: [Users] TR: Enabling drag n drop in the Ext.tree.TreePanel(enableDD)
>
> Hello,
>
> If I remember correctly, the LayerContainer class contains the code to
> support the drag-drop. If you manually create the node, you have to add
> the code by yourself. This is because the LayerContainer (and
> sub-classes) know about other layers, but the node itself doesn't.
>
> If I continue to remember correctly, there's an event thrown on the drop
> (of the drag-drop), simply check your node order there and change your
> map layer order accordingly.
>
> I hope others can correct me if I'm wrong.
>
> Julien
>
> On 13-02-05 02:02 PM, Valiquette,Francois [Montreal] wrote:
>> Hello,
>>
>> I am the original poster. I succeeded easily to change the drawing order
>> of the layer with the drag and drop feature using a
>> GeoExt.tree.LayerContainer. But I still cannot change the drawing order
>> when I am manually creating my nodes (GeoExt.tree.LayerNode). By this, I
>> mean, I can drag and drop but nothing happens.
>>
>> I will try to play a little bit more with my code....
>>
>> Thank you
>>
>> *De :*users-bounces at geoext.org [mailto:users-bounces at geoext.org] *De la
>> part de* Valiquette,Francois [Montreal]
>> *Envoyé :* 5 février 2013 12:31
>> *À :* users at geoext.org
>> *Objet :* [Users] Enabling drag n drop in the Ext.tree.TreePanel (enableDD)
>>
>> Hello,
>>
>> As written in
>> http://www.geoext.org/tutorials/layertree-tutorial.html?highlight=drag,
>> if I set /enableDD / to true of my TreePanel, it will enable layers
>> reordering. Does it mean that the user can reorder layers in the
>> TreePanel or does it mean that the user can reorder the display order in
>> the the MapPanel to make a specific layer appear on top of another one?
>>
>> I tried to enableDD but when I drag and drop, the layer drawing order
>> does not change. So I just want to if I missed something J
>>
>> Thank you
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>
--
More information about the Users
mailing list