cmv / cmv-app

CMV - The Configurable Map Viewer - A community supported open source mapping framework built with the Esri JavaScript API and the Dojo Toolkit
https://demo.cmv.io/
MIT License
325 stars 278 forks source link

How to clear graphics of all widgets ? #895

Closed mayur9785 closed 4 years ago

mayur9785 commented 5 years ago

Hi, How do i clear graphics of specific widget and also, loop through all widgets of viewer.js file and clear graphics ?

I have widgets Nagivation https://github.com/friendde/ArcGIS_JS_NavigationTools and added one more button of clear graphics.

I would like to clear graphics of specific widget and also loop through all widgets and clear graphics ?

Thanks,

tmcgee commented 5 years ago

You probably can't easily loop through all widgets and clear graphics layers for each widget. You can loop through all the graphics layers in the map and clear the graphics in each layer. Note that any Feature layers on the map (and a few others) are also graphics layers so you can't assume all graphic layers contain features added from a widget or other programmatic methods that can/should be cleared from the map.