only one layer is visible at any given time. If user clicks a layer to make it visible then the control should automatically uncheck the previous visible layer if any is visible.
toc.on('toc-node-checked', function(evt){ if (evt.checked && evt.rootLayer && evt.serviceLayer){ // this basically tell the service only set the one layer clicked visible. TOC will automatically check off other layers. evt.rootLayer.setVisibleLayers([evt.serviceLayer.id]) } } });
toc.on('toc-node-checked', function (evt) { if (evt.checked && (evt.rootLayer.id === "theID") && evt.serviceLayer) { evt.rootLayer.setVisibleLayers([evt.serviceLayer.id]); } });
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.