Select to view content in your preferred language

Customize Legend Widget to Change Order of Feature Layers on Base Map with Click Event

06-16-2023 12:59 PM
New Contributor III

Hello all! 

So I'm in a bit of pickle. I'm creating a custom legend widget which will list the feature layers on a map. I'd like to be able to create a button or something on the legend itself to shift/unshift the order of the feature layers as they are displayed on the map. 

I made the legend widget from a clone of this widget repo on github but there doesn't seem to be a whole lot I can do to customize it. 

Screen Shot 2023-06-16 at 3.38.06 PM.png

Consider this screenshot of what I have so far. Ideally what I'd like to do is make a button (or any type of click-event mechanism really, i'm not picky) to change the order at which the layers are stacked on the base map. In the screenshot it's layered top-to-bottom as 1, 2, 3, but I'd love to be able to change the order to 2,1,3 or 1, 3, 2 or 3,2,1 or whatever AFTER the initialization of the feature layers.


Anyone think they can help me out with this? I'm working with ArcGIS Experience Builder and building the custom legend widget with TypeScript and React.js. I'm still kinda new-ish to ArcGIS Experience Builder Widgets so any help is super appreciated. Thanks y'all

0 Replies