How can I set group layers to just have a heading (no option to turn on/off)

12-27-2021 03:12 PM
New Contributor II

I have a Group Layer, and am using the LayerList widget. By default, I have all of the sub-layers in the Group Layer turned Off (visible: false). Thus when a user clicks on the Group Layer (in the LayerList) nothing happens - they have to expand the Group Layer to see the contents and then turn the individual layers On.

I would like to remove the option to turn the Group Layer On / Off (since clicking the On / Off eyeball is confusing since nothing happens when the user clicks the eyeball). Instead I would like the Group Layer name to simply be a heading that can be expanded / contracted to expose the sub-layers.

Essentially, I just want the Group Layer to be always On (with the sub-layers still off by default).

So, rather than seeing:

> (eyeball) Transportation
          (eyeball) Bus Stops
          (eyeball) Bike Routes

I want to have:

> Transportation
          (eyeball) Bus Stops
          (eyeball) Bike Routes

* Edit / Addition: If it makes a difference, ALL of the items in my LayerList could be Group Layers. So maybe there is a way to just have an expandable List of Group Layers...?

Anyone have any suggestions? Or some other way to create a simple group layer w/a header?



arcgis api for javascript 4.2x

Tags (1)
0 Kudos
0 Replies