<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Reordering of dynamic layers with groups (parents and sublayers). in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/reordering-of-dynamic-layers-with-groups-parents/m-p/459885#M42515</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to reorder layers in the instance of &lt;/SPAN&gt;&lt;STRONG&gt;esri.layers.ArcGISDynamicMapServiceLayer&lt;/STRONG&gt;&lt;SPAN&gt;. I saw &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/layers_dynamic_reorder.html"&gt;this&lt;/A&gt;&lt;SPAN&gt; sample for learning.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I have two map services with enabled &lt;/SPAN&gt;&lt;STRONG&gt;Dynamic Layer&lt;/STRONG&gt;&lt;SPAN&gt; option. First service contains a plain list of layers, and the second contains grouped layers (parents and sublayers). Reordering on the first service &lt;/SPAN&gt;&lt;STRONG&gt;works fine&lt;/STRONG&gt;&lt;SPAN&gt;, but on the second service layers becomes invisible after reordering (both layers has a same parent).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are there some restrictions on layers reordering, when layers are in groups? Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Oct 2012 11:25:59 GMT</pubDate>
    <dc:creator>ViktorLozhkin</dc:creator>
    <dc:date>2012-10-24T11:25:59Z</dc:date>
    <item>
      <title>Reordering of dynamic layers with groups (parents and sublayers).</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/reordering-of-dynamic-layers-with-groups-parents/m-p/459885#M42515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to reorder layers in the instance of &lt;/SPAN&gt;&lt;STRONG&gt;esri.layers.ArcGISDynamicMapServiceLayer&lt;/STRONG&gt;&lt;SPAN&gt;. I saw &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/layers_dynamic_reorder.html"&gt;this&lt;/A&gt;&lt;SPAN&gt; sample for learning.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I have two map services with enabled &lt;/SPAN&gt;&lt;STRONG&gt;Dynamic Layer&lt;/STRONG&gt;&lt;SPAN&gt; option. First service contains a plain list of layers, and the second contains grouped layers (parents and sublayers). Reordering on the first service &lt;/SPAN&gt;&lt;STRONG&gt;works fine&lt;/STRONG&gt;&lt;SPAN&gt;, but on the second service layers becomes invisible after reordering (both layers has a same parent).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are there some restrictions on layers reordering, when layers are in groups? Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 11:25:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/reordering-of-dynamic-layers-with-groups-parents/m-p/459885#M42515</guid>
      <dc:creator>ViktorLozhkin</dc:creator>
      <dc:date>2012-10-24T11:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Reordering of dynamic layers with groups (parents and sublayers).</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/reordering-of-dynamic-layers-with-groups-parents/m-p/459886#M42516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm also having some trouble with implementing grouped layers reordering in my JS app.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So far I've succeded in reordering layers inside a group, which is a piece of cake, and is as simple as the example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
/* ------------------------------------------------------------------------------------*/
// Let's assume that we have a dynamic layer with id "dynamicLayerId" on the map
// and the sublayer of "dynamicLayerId" with id 0 is the parent of sublayers with ids 1 and 2
//
// This code will swap sublayers 1 and 2 and display them on the map
/* ------------------------------------------------------------------------------------*/

var layer = map.getLayer("dynamicLayerId");
var dynamicLayerInfos = layer.createDynamicLayerInfosFromLayerInfos();

// changing the order
dynamicLayerInfos[1].id = 2;
dynamicLayerInfos[2].id = 1;

// updating the dynamic infos of the layer
layer.setDynamicLayerInfos(dynamicLayerInfos);

// display the sublayers on the map
layer.setVisibleLayers(["1", "2"]);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I'm having trouble with is reordering the whole groups. The picture shows what happens inside dynamicLayerInfos when someone tries to reorder the groups in my app:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]26695[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;After updating the dynamicLayerInfos of the layer, no sublayer is shown on the map (when there are some visibleLayers set). So my question is: Am I doing something wrong here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Also I would really appreciate if someone, who has done it, could share some code ;]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS. It's an old topic, I know, but it'd be bad to leave it without some useful answers;]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;EDIT: FINALLY!&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Writing this post and reading it made me realise that I didn't &lt;/SPAN&gt;&lt;STRONG&gt;update parentLayerId properties of the group members&lt;/STRONG&gt;&lt;SPAN&gt;. I fixed that and the problem is gone - everything works fine :D.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:28:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/reordering-of-dynamic-layers-with-groups-parents/m-p/459886#M42516</guid>
      <dc:creator>JakubMalec</dc:creator>
      <dc:date>2021-12-11T20:28:11Z</dc:date>
    </item>
  </channel>
</rss>

