Solved! Go to Solution.
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]) } } });
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]); } });