<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Info Window result in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/info-window-result/m-p/509894#M47409</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This should be pretty easy. Use a function to actually populate the content of your infoWindow. First, create your infoTemplate:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; var theTemplate = new esri.InfoTemplate();
 theTemplate.setContent(setPopupContent);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Next, set up your dojo.connect for clicks on the features in your layer:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; //Listener event for feature selection and the popup info widow 
 dojo.connect(theFeatureLayer,"onClick",function(evt){
&amp;nbsp; //Listener event for feature selection and the popup info widow
&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp; query.geometry = pointToExtent(map,evt.mapPoint,15);

&amp;nbsp; var deferred = theFeatureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW); 
&amp;nbsp; map.infoWindow.setFeatures([evt.graphic]);
&amp;nbsp; map.infoWindow.show(evt.mapPoint);
 });&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Lastly, create the function which will populate your template with the content you want:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; function setPopupContent(graphic) {
 attr = graphic.attributes;
 curState = attr.STATE;
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; content = 'Create your content here';

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //If The state clicked is ABC, append the special notation
 if (curState == "ABC") {
&amp;nbsp; content = content + "&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;(estimates based on State average)";
 }
 
 
 return content;
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Steve&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Steve,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My scenario is a bit different. In my app, the user might select multiple geographies (states) at one time, but the infoWindow content should display differently only for the selected (developer-specified) geography.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried this code earlier, but this would set the result content for all geographies if the selected geography is part of the subset:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for ( j = 0; j &amp;lt; newGeog.length; j++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (newGeog&lt;J&gt; == "A" || newGeog&lt;J&gt; == "B" || newGeog&lt;J&gt; == "C") {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resultContent = "&amp;lt;tr&amp;gt;" + indc + ": &amp;lt;td&amp;gt;${" + indv + ":formatNumber} (State average)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resultContent = "&amp;lt;tr&amp;gt;" + indc + ": &amp;lt;td&amp;gt;${" + indv + ":formatNumber}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/J&gt;&lt;/J&gt;&lt;/J&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 22:19:54 GMT</pubDate>
    <dc:creator>SamirGambhir</dc:creator>
    <dc:date>2021-12-11T22:19:54Z</dc:date>
    <item>
      <title>Info Window result</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/info-window-result/m-p/509892#M47407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In my application, I would like to set infoTemplate so that it can display additional information in the infoWindow (not in the title) based on which feature is clicked e.g. if features in the State 'ABC' are clicked, the info window should show additional text such as "(estimates based on State average)", but should not show this additional text when click on any other feature. How do I accomplish this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Samir&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Mar 2013 13:57:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/info-window-result/m-p/509892#M47407</guid>
      <dc:creator>SamirGambhir</dc:creator>
      <dc:date>2013-03-19T13:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Info Window result</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/info-window-result/m-p/509893#M47408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This should be pretty easy. Use a function to actually populate the content of your infoWindow. First, create your infoTemplate:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; var theTemplate = new esri.InfoTemplate();
 theTemplate.setContent(setPopupContent);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Next, set up your dojo.connect for clicks on the features in your layer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; //Listener event for feature selection and the popup info widow 
 dojo.connect(theFeatureLayer,"onClick",function(evt){
&amp;nbsp; //Listener event for feature selection and the popup info widow
&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp; query.geometry = pointToExtent(map,evt.mapPoint,15);

&amp;nbsp; var deferred = theFeatureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW); 
&amp;nbsp; map.infoWindow.setFeatures([evt.graphic]);
&amp;nbsp; map.infoWindow.show(evt.mapPoint);
 });&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lastly, create the function which will populate your template with the content you want:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; function setPopupContent(graphic) {
 attr = graphic.attributes;
 curState = attr.STATE;
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; content = 'Create your content here';

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //If The state clicked is ABC, append the special notation
 if (curState == "ABC") {
&amp;nbsp; content = content + "&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;(estimates based on State average)";
 }
 
 
 return content;
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:19:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/info-window-result/m-p/509893#M47408</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2021-12-11T22:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Info Window result</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/info-window-result/m-p/509894#M47409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This should be pretty easy. Use a function to actually populate the content of your infoWindow. First, create your infoTemplate:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; var theTemplate = new esri.InfoTemplate();
 theTemplate.setContent(setPopupContent);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Next, set up your dojo.connect for clicks on the features in your layer:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; //Listener event for feature selection and the popup info widow 
 dojo.connect(theFeatureLayer,"onClick",function(evt){
&amp;nbsp; //Listener event for feature selection and the popup info widow
&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp; query.geometry = pointToExtent(map,evt.mapPoint,15);

&amp;nbsp; var deferred = theFeatureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW); 
&amp;nbsp; map.infoWindow.setFeatures([evt.graphic]);
&amp;nbsp; map.infoWindow.show(evt.mapPoint);
 });&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Lastly, create the function which will populate your template with the content you want:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; function setPopupContent(graphic) {
 attr = graphic.attributes;
 curState = attr.STATE;
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; content = 'Create your content here';

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //If The state clicked is ABC, append the special notation
 if (curState == "ABC") {
&amp;nbsp; content = content + "&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;(estimates based on State average)";
 }
 
 
 return content;
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Steve&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Steve,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My scenario is a bit different. In my app, the user might select multiple geographies (states) at one time, but the infoWindow content should display differently only for the selected (developer-specified) geography.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried this code earlier, but this would set the result content for all geographies if the selected geography is part of the subset:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for ( j = 0; j &amp;lt; newGeog.length; j++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (newGeog&lt;J&gt; == "A" || newGeog&lt;J&gt; == "B" || newGeog&lt;J&gt; == "C") {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resultContent = "&amp;lt;tr&amp;gt;" + indc + ": &amp;lt;td&amp;gt;${" + indv + ":formatNumber} (State average)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resultContent = "&amp;lt;tr&amp;gt;" + indc + ": &amp;lt;td&amp;gt;${" + indv + ":formatNumber}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/J&gt;&lt;/J&gt;&lt;/J&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:19:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/info-window-result/m-p/509894#M47409</guid>
      <dc:creator>SamirGambhir</dc:creator>
      <dc:date>2021-12-11T22:19:54Z</dc:date>
    </item>
  </channel>
</rss>

