Select to view content in your preferred language

How to remove  and reorder layers from TOC widget?

792
3
06-01-2014 11:06 PM
GauriDeshmukh
Deactivated User
How should I access the layers or select layers to remove or reorder.I am using TOC widget by nliu. But I want to add functionality to remove layers similar to arcmap(on right click remove or any other way).
0 Kudos
3 Replies
JeffPace
MVP Alum
The TOC widget is just a representation of map.layers

You can remove and reorder them using map.addLayer, map.reorderLayer, and then calling TOC.refresh() as necessary.
0 Kudos
GauriDeshmukh
Deactivated User
But how should I select or access the layer from toc to remove or refresh. I want remove or reorder layers from toc only.
0 Kudos
GauriDeshmukh
Deactivated User
I guess we will use   "   toc.on('toc-node-checked', function(evt){}   "   event to get the selected ayers(for removing or reordering).
But not sure as unable to do it.
0 Kudos