Select to view content in your preferred language

DragEnabled using LayerList

350
2
Jump to solution
11-27-2024 12:31 AM
Antonio_Fraga
Emerging Contributor

 

Hi!

I am trying to use `dragEnabled` with the `LayerList` widget and three `FeatureLayers`, but I cannot reorder my layers. Could someone provide me with a functional example of how to use it?

Thank you.

0 Kudos
1 Solution

Accepted Solutions
Sage_Wall
Esri Regular Contributor

Hi @Antonio_Fraga ,

If you are using the layer list component you can use the drag-enabled attribute like this:

 

<arcgis-layer-list drag-enabled position="top-right"></arcgis-layer-list>

 

https://codepen.io/sagewall/pen/raBNdxq 

 

Or if you are using the widget you set the dragEnabled property to true like so:

 

          const layerList = new LayerList({
            dragEnabled: true,
            view: view
          });

 

https://codepen.io/sagewall/pen/vEBYRGN 

 

Hope this helps 🙂

View solution in original post

0 Kudos
2 Replies
Sage_Wall
Esri Regular Contributor

Hi @Antonio_Fraga ,

If you are using the layer list component you can use the drag-enabled attribute like this:

 

<arcgis-layer-list drag-enabled position="top-right"></arcgis-layer-list>

 

https://codepen.io/sagewall/pen/raBNdxq 

 

Or if you are using the widget you set the dragEnabled property to true like so:

 

          const layerList = new LayerList({
            dragEnabled: true,
            view: view
          });

 

https://codepen.io/sagewall/pen/vEBYRGN 

 

Hope this helps 🙂

0 Kudos
Antonio_Fraga
Emerging Contributor

Hi @Sage_Wall ,

I just realized, thanks to your example, that it was referencing version 4.28 of the API. I updated it to 4.31, and it works perfectly.

Thank you!

@Antonio_Fraga