eafrey

QueryTask - set Content dynamically

Discussion created by eafrey on May 19, 2010
Hi,

For showing some attribute information in a InfoWindow I use the esri.InfoTemplate from the js samples: http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jssamples_start.htm

For the content of the InfoWindow the samples are always with static information. Is there a way to define my content dynamically, for example: I have an field for the URL but not every feature has an URL. How do I define my content, if I just want the URL shown up in the InfoWindow where there is really one? I tried this but it doesn't work:

var infoTemplate = new esri.InfoTemplate();
        infoTemplate.setTitle("${poi_name}");
        theContent = "<b>Category: </b>${hauptkat}";
        iUrl = "${infourl)";
        if (iUrl != '') {theContent += "<br/><b>Website: </b>${infourl}"; }
        infoTemplate.setContent(theContent);

Thanks for your Help

Esther

Outcomes