LayerList - Layer Reorder with Dynamic Workspaces

1704
5
12-15-2016 11:44 AM
PremRadhakrishnan
New Contributor III

Hello, 

I noticed that the LayerList widget does not allow to move layers even if the underlying map service has dynamic workspaces - allow per request modification enabled. 
Is there an easy way to fix this? I started poking around with the PopupMenuInfo.js class in the LayerList widget and noticed that "FeatureLayer" types do not have this option. So I duplicated the Widget and tried to add it in but it shows up as a disabled menu item. I did some further digging and noticed that the logic for this is true since Move Up and Move Down by design is only available for RootLayers not individual layers in a service. 

Any idea on the proper direction to take here? Has anyone done this before ? 

Thanks in advance, 

Prem

5 Replies
RobertScheitlin__GISP
MVP Emeritus

Prem,

   There is a reason that FeatureLayers do not have the move option in the menu and that is because in the JS API FeatureLayers are always drawn on top of other layers types and can not be moved below other types. So even if you do get that menu option enabled it will do you no good.

PremRadhakrishnan
New Contributor III

Thank you Robert, I understand that FeatureLayers are essentially drawn in the order that they are added to the map. 

Let me try to explain a bit futher. I have a web map in ArcGIS portal that comprises of two Dynamic services both of which have layer order and symbology enabled. They have a pretty sizable number of layers. 

I am in the process of converting a Flex app to WAB and the layer order was something that was available before. I am trying to replicate this functionality in WAB since opening the Web Map in a viewer lets me reorder the layers I assumed that I can replicate this in WAB.  I understand if LayerList may not be extendable this way, so looking for ideas from WAB experts. I am new to WAB but not JS API. 

I find the API documentation somewhat lacking but that may just be my inexperience with WAB.   

RobertScheitlin__GISP
MVP Emeritus

Prem,

   No you are missing what I am saying. FeatureLayers and GraphicsLayer will always be drawn above other layer types and there is nothing you can do to change that, it is a limitation of the 3.x JS API.

PremRadhakrishnan
New Contributor III

Robert, 

Thanks again for the attempt to clarify. Maybe I am missing something here. 

If I have two FeatureLayers I can control which FeatureLayer is displayed on top, just as if I had two Graphics Layers. So essentially since all my layers are treated as individual FeatureLayers in WAB instead of a Dynamic Service, I should be able to control the order. 

I get what you are saying that FeatureLayers/GraphicLayers are drawn above all else, but the order of those can be controlled if there are more than one of those at the top. So if I added 2 graphicsLayers to a map, the one added last would be at the very top. 

If I am not understanding this correctly in reference to WAB would you elaborate?

Cheers

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Perm,

   No, you are correct in that understanding.

0 Kudos