AnsweredAssumed Answered

how do I access all attributes in a MapImageLayer SubLayer from PopupTemplate

Question asked by tweber_GCS on Sep 13, 2018
Latest reply on Sep 13, 2018 by tweber_GCS

hello,

 

I have a MapImageLayer (hosted on our portal), with several sublayers. I wish to display some other data in the popup by using a function to return the content (the function is getting called, and I can return what I want). However, the attribute data I need to create/query the other data (non-arcgis data) is not being passed to the content function. The only attribute being sent back is the 'Name' field, and I cannot find a way to set the outFields property for the query that gets run.

 

Snippet

         this.map.layers.forEach((layer) => {
           if (layer.title === 'Some Title') {
             layer.outFields = ["*"]; //<-- does nothing
             layer.sublayers.forEach(subLayer => {
               subLayer.outFields = ["*"]; //<-- also does nothing
               if (subLayer.title === 'hidden layer') {
                 subLayer.visible = false;
               } else if (subLayer.title === 'other layer') {
                   this.otherLayer = subLayer;
               }
               subLayer.popupTemplate = {
                   title: subLayer.title,
                   content: this.getData.bind(this),
                   actions: [{
                     id: subLayer.title,
                     className: 'esri-icon-table',
                     title: 'Dashboard'
                   }]
               };
             }
             });
           }
         });

 

Snippet

getData(evt) {
     console.debug(evt); //<-- only attribute is 'Name'
     console.debug(this.view.popup.viewModel.selectedFeature); //<-- same

There are definitely more attributes on the layer, but only Name is being returned. Am I missing something somewhere in my code to set the outFields for a Portal hosted MapImageLayer? or is there something I need to have changed in the service to return all attributes? thanks!

Outcomes