The issue is well known and discussed at different places (here for exemple https://community.esri.com/inbox?objectType=2&objectID=74029 )
You can find an exemple using this template here.
- This widget was developed for ESRI's Classic Viewer to add sub layer visibility
functionality to it. It won't work in ESRI's new 2015 Classic Viewer layout. For
other templates additional work would be needed to make the widget compatible with
the specific layout.
- To add the widget to the template, you'll need to instantiate the dojo class:
require(["eea/module/SubLayerTocMod"], function (SubLayerTocMod) {
new SubLayerTocMod(<LayerList>);
});
- You'd need to prevent the default layer selector from loading.
- The widget expects to find a configuration variable in the global configOptions object.
The TOC level represents how many layer levels will the TOC show at maximum. It's an integer and,
if not set, only the topmost level will be shown.
configOptions.tocLevel
Widget develloped by Herdis Gudbrandsdottir (Thank you)