Select to view content in your preferred language

Allow re-order and grouping of layer list within Experience Builder without altering Web Map

531
8
Jump to solution
07-10-2024 12:41 PM
Labels (1)
ericsamson_tract
Occasional Contributor

Hey all,

Was wondering if anyone had figured out a way around this. I've found several posts about the frustration of organizing layers on Experience Builder (since this was such an issue with web app builder, figured this would have been a focus?)

Here's a post discussing some of the ways around this:

https://community.esri.com/t5/experience-builder-tips-and-tricks/five-ways-to-handle-groups-of-layer...

To reiterate my goal from my post title: I want to control the order of the layers within the layer list widget from within Experience Builder, not within the web map, because I want to maintain the draw order that I set within the web map. Therefore, I also do not want to create groups from within the web map, since that will mess up the draw order. I should be able to create both groups and re-order the layers directly on the experience builder side.

I've also attempted to use @JeffreyThompson2 widget (thank you!) to help add and remove groups of layers here:

https://community.esri.com/t5/experience-builder-custom-widgets/add-remove-layers-by-group/m-p/12950...

However, when re-creating a layerlist type component you lose all of the functionality of things like search, adding to attribute table, export, setting filter, etc etc. We should be able to alter the layer list widget directly.

This was an issue with web app builder as well, but there were ways around it like the community created "table of contents" custom widget. Also, back then I was able to create a custom layerlist using advice from @RobertSheitlin_GISP for web app builder:

https://community.esri.com/t5/arcgis-web-appbuilder-questions/permanently-change-the-order-in-layer-...

Where you alter the LayerListView.js refresh function and hard code the layers in with IDs.

Is there anywhere in Experience Builder's code where we could alter the order and layers that are being displayed within the Layer List widget? This should really be something built into Experience builder though.

 

0 Kudos
1 Solution

Accepted Solutions
JeffreyThompson2
MVP Regular Contributor

The OOTB Map Layers Widget is built-on the Layer List Widget from the JavaScript API. Neither the Experience Builder or API version of this widget easily expose a method for re-ordering layers. If you are interested in building your own layer list, this example would be a good place to start.

https://community.esri.com/t5/experience-builder-custom-widgets/popup-identify-controller/ta-p/14956...

GIS Developer
City of Arlington, Texas

View solution in original post

8 Replies
JeffreyThompson2
MVP Regular Contributor

As in ArcGIS Pro, the order of layers in the map and in the layer list are fundamentally linked. This is how they are designed to operate. Getting the data into an order different from the drawing order would require developing a custom widget.

GIS Developer
City of Arlington, Texas
0 Kudos
ericsamson_tract
Occasional Contributor

Thanks for the reply. So there is no where to hard-code this list order within the layer list, like we could with web app builder? I am not as familiar with the source code with experience builder, but most things are minified so it's tough to do a quick browse through.

0 Kudos
TonghuiMing
Esri Regular Contributor

You can re-order them in the OOTB AGOL widget, with the following option:

TonghuiMing_0-1720668415221.png

You can temporarily change the grouping by dragging the handler as well:

2024-07-11_11-28-07.gifThis was added in the Mar 2024 AGOL release (supported by API core also). Note that this only is applicable when there is more than one layer existing.

Hope it helps.

0 Kudos
ericsamson_tract
Occasional Contributor

This does not permanently change the order of the layers. It is only temporary. Both if the layers are in group or not. Unless I am doing something wrong.

0 Kudos
TonghuiMing
Esri Regular Contributor

Yes, the purpose is to change the order of layers on the fly. This widget would not include the ability to modify the map configurations, that's the capability of web maps - this is the expected behavior.

ericsamson_tract
Occasional Contributor

I understand that that the purpose of that functionality is to be on fly. My end goal is to group the layers and arrange them permanently, not on the fly, while keeping the same draw order in the web map. So this does not solve my problem.

As my original post lays out, it does not make sense to change the layer order within the web map. The web map should hold the correct layer draw order, and then within experience builder, the creator can re-order or re-group layers by categories, that way the draw order set in the original web map is withheld.

We had the capability to do this in web app builder by directly editing the source code for the layer list widget, specifically in the layerlistview.js file.

My original question was: Is there anywhere within the experience builder code that I can alter to hard code the layer list order or create groups of layers? Especially if this functionality is not planned to be offered out of the box?

0 Kudos
JeffreyThompson2
MVP Regular Contributor

The OOTB Map Layers Widget is built-on the Layer List Widget from the JavaScript API. Neither the Experience Builder or API version of this widget easily expose a method for re-ordering layers. If you are interested in building your own layer list, this example would be a good place to start.

https://community.esri.com/t5/experience-builder-custom-widgets/popup-identify-controller/ta-p/14956...

GIS Developer
City of Arlington, Texas
ericsamson_tract
Occasional Contributor

That is a huge bummer. I figured this is something that would have been fixed with the move to experience builder. Thanks for the advice, I will explore my options.

0 Kudos