Reorder TOC Sublayers

677
5
11-01-2013 06:59 AM
AaronBarkhurst
New Contributor
Is it possible to move the sublayers (children) up and down in the TOC and map drawing order? I have set the ability to drag and drop layers in the TOC, the UI allows the ability to move the sublayers, but the map/toc reorder only applies to the parent layers. Is there a way to allow users to reorder the sublayers both in the TOC and map drawing/layering? Do each of the sublayers have to brought in as ArcGISMapServiceLayers for this to work?

Gratefully,

Aaron
Tags (2)
0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus
Aaron,

   There is a whole sample dedicated to demonstrating exactly what you are asking:

https://developers.arcgis.com/en/flex/sample-code/changelayerordering.htm
0 Kudos
AaronBarkhurst
New Contributor
Robert,

Thank you for the link. I looked over it and have been working to get something similar implemented into the TOC widget and here's where I'm at.

The data source for the TOC in the link you referenced is a list of the layer infos, but the TOC widget TOC scroller seems to only really be "aware" of the main parents (indices) involved in the scroller if there are subcategories/layers. So what I was attempting to do was to dispatch an event with the TOC data on the dragDrop event. From there, I was going to listen for that dispatched event in the TocMapLayerItem.as and basically create and run another function similar to the createChildren function that would reorder the dynamic layer infos to match the new order of the subcategories/layers and then call toc.map.reorderLayer to redraw the map layers. However I'm having some trouble getting the index of the subcategory/layer being moved to be able to know how to reorder the dynamic layer infos in the new function.

Am I WAY off track here? If so, do you have an easier solution/idea that could get me on the right path?

Gratefully,

Aaron
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Aaron,

   You are off in a whole new area that I have not considered going down. I don't have any advice at this point.
0 Kudos
AaronBarkhurst
New Contributor
Robert,

My crazy method aside, is there a more efficient method that makes more sense? Or is this something you haven't dealt with or attempted?

Thanks,

Aaron
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Aaron,

  This is something I have not dealt with or attempted. It seems like an awefull lot of code and headache for little return on needed ability.
0 Kudos