Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I used the ArcGIS Javascript layer reordering sample as template.

Initially I have 4 layers added to the map by ArcGISDynamicMapServiceLayer where reordering was working. Then, instead of using add lake from a table, I add 5 other layers using ArcGISDynamicMapServiceLayer again and pushed the layers into the first ArcGISDynamicMapServiceLayer with DynamicLayerInfos.push(newDynamicLayerInfo).

The drag and drop list would update to include all the old + new layers. But the new layer wouldn't reorder.

I drag the new layers all the way to the top and move it around. What ended up happen was that no matter name in the list was the first four item, it would change the order of the older layers. Example:

old1 => old layer1
old2 => old layer2
new4 => old layer3
new3 => old layer4

so if I move it around this would happen

old1 => old layer1
new3 => old layer4
new4 => old layer3
old2 => old layer2

It doesn't seem to be registering the new layer in the older ArcGISDynamicMapServiceLayer which I push the new layers into. Can anyone tell me what I did wrong?


function addProperty(){
    var propertyLayer, propertyDynLayerInfos, dynamicLayerInfo;

    // disable the "Add Property" button
    dijit.byId("property").set("disabled", true);

    // show a loading icon
    //"loading"), "display", "inline-block");"loading"), "visibility", "visible");

    urlDyn = "";
    propertyLayer = new esri.layers.ArcGISDynamicMapServiceLayer(urlDyn, { "id": "Property2" }); //only work for mapserver not featureserver;

    var addLayerhandler = dojo.connect(
        function() {
  "loading"), "visibility", "hidden");

            // create a new dynamic layer info object for the property layer
            if ( ! app.hasOwnProperty("dynLyrInfos") ) {
                app.dynLyrInfos ="Kings County").createDynamicLayerInfosFromLayerInfos();

            // add new layers
            //propertyDynLayerInfos = propertyLayer.hasOwnProperty("dynamicLayerInfos") ? propertyLayer.dynamicLayerInfos : propertyLayer.layerInfos;
            propertyDynLayerInfos = propertyLayer.createDynamicLayerInfosFromLayerInfos();
            alert(propertyLayer + " " + propertyLayer.hasOwnProperty("dynamicLayerInfos"));
                function(dynamicLayerInfo, i)

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.