0

I have a web app that was built with JavaScript API 4.10. One of my layers is a map image layer that includes many sub-layers with some fields that have domains. The issue is that in the pop-up only the domain codes show, but not the values. If I add the map service in AGOL or Portal the domains values show correctly.

Here is the code where this specific map image layer was added:

var Utilities = new MapImageLayer({
url: "https://domain.../arcgis/rest/services/.../Utilities/MapServer",
title: "Utilities - CADD Master Files"
});
Utilities.watch("loaded", function() {
    for (i=0;i<Utilities.allSublayers.length;i++) {
        var this_layer = Utilities.allSublayers.items[i];
        //this_layer.visible = false;
        if (this_layer.sublayers == null) {
          crtPopUpTemplate(Utilities.url, this_layer.id,this_layer);
        }
        else {
            //console.log("This layer has a sublayer");
            //In production mode, remove console.logs 
        }
    }
  })

Code for the pop-up template function (used for almost all layers in the app):

function crtPopUpTemplate(basicURL, layerID, layerVName) {
    var url = basicURL+'/'+layerID.toString()+'?f=json';
    esriRequest(url, {responseType: "json"}).
      then(function(response){
        Alldata = response.data;
        var titleLayer = Alldata.name;
        if (titleLayer.includes('_') == true) {
            resultIf = titleLayer.replace(/_/g," ");
        } else {
          resultIf = titleLayer;
        }

        let fieldInfosArray = [];
        for(let i=0; i<Alldata.fields.length; i++) {
          fieldInfosArray[i] = {fieldName: Alldata.fields[i].name, label: Alldata.fields[i].alias}
        }

        template1 = {
        title: resultIf,
        content: [{
         type: "fields",
         fieldInfos: fieldInfosArray
        }]
        };
        layerVName.popupTemplate=template1;
      });
  }

Any ideas?

0

Seems that this was a bug with ArcGIS JavaScript API and it was fixed with the release of JS API 4.15.

I just changed my app to use 4.15.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.