The LayerList Widget in the JS API is barely functional from scratch.
As the samples in the documentation shows it can list layers or group layers while multiple group layers only can be shown per radio button (so only one at a time). Plus each Layer and sublayer can set visible/invisible.
https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist/
https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-actions/
Further actions like settings (change layer display name, toggle labels on/off, opacity, etc.) need to be implemented by hand.
Also dragging the layers order for z-index visibility is not possible out of the box.
Another use case is an introduction plus tight coupling of the add-data-widget which does not exist as widget in the JS SDK API without custom implementations. The widget does exist on ExpBuilderApp where it allows to add further portal layers or external layer via URL. A combined UI (like tabbing) is desired.
Also an integration of the basemaps-widget is useful.
This is the out out-of-the-box layout of the layer-list-widget:
This is the out-of-the-box layout of the add-data-widget in ExpBuilder:
Adding new layers is simple but it is not possible out of the box to remove them from the local layer list.
Also the add data widget has its own list ob added data, unnecessary duplicate to the layerlist widget.
We worked around that creating custom code which creates much maintenance during every version update of the SDK and still lacks of some functionality (like we do not support group layers yet because of the deep coded layer handles which causes negative side effects in other parts of code and is not yet solved on our side).
So far our custom widget can:
I created a short screen recoding showing the idea of the widget. Some may notice some minor issues of workflows which they may would solve in a different way. This is why we came here with the idea to get that as part of the SDK since we think this could be a great tool for every developer not only us.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.