AnsweredAssumed Answered

Custom Info template window

Question asked by kshah77 on Feb 1, 2016
Latest reply on Feb 1, 2016 by kshah77

I have an issue with  info template window. I used set content method to display calculated value by geometry engine service. It works fine for displaying calculated value but cannot join other fields information. Here is my code:

 

var template = new esri.InfoTemplate();

         template.setTitle("<b>Cooperator: </b> ${Cooperator}"); 

         template.setContent("<b>PropertyName: <b> ${PropertyName} <br>");      // this cannot be displayed

         template.setContent(getTextContent);

 

 

var layer = new FeatureLayer("URL", {

          infoTemplate: template,

          outFields: ["*"],

          opacity: 0.5

        });

      

        // convert squarefeet to acre

       

        function getTextContent(value) {

  var sqft = geometryEngine.geodesicArea(value.geometry, "square-feet"); 

  var squarefeet = number.format(sqft, { places: 1 }); 

  var acres = number.format(sqft / 43560, { places: 0 }); 

  return "Acres :" + acres ;

  };

 

        map.addLayers([layer]);

Outcomes