Is it possible to change the layer order in the LayerList widget without changing the drawing order in the mapview?
I tried using the layerList.viewModel.moveListItem() method, but the mapview is updated to reflect the layerList order.
NOTE: JS api 4.x
The LayerList is designed to reflect the order of the layers in the map. In part for when `selectionEnabled` is true users can modify the layer order in the map. I'm curious as to your use case for having them be different?
I use the layerList with selection disabled.
Here is my use case. I have my layers ordered like so:
This way, I can display a map like this, with a hidden water layer over my imagery layers:
This work great, but I woud like to be able to group "Point feature layer 1" with Imagery layer 1" and so on because they are actually related. But If I do that, I end up with my Point layers hidden behind the water features:
Maybe there is a way to unsuscribe to some kind of layerList layerMoved event?. Else I might have to directly modify the DOM.
Sorry @Nicolas_ there isn't anything currently in the API for this, but I think it's a valid use case. I'd like to move this over to ArcGIS Ideas because it could be a great future addition to the JavaScript Maps SDK. The best possible workaround I can see is to duplicate the hidden water layer into each imagery + point group layer, but it's less than ideal to have to add multiple copies of the same layer.
I wrote my own layer list mimicking the behavior of the original, except it uses locally predefined definition expressions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.