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]); } });
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.