<?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: make esri.dijit.Popup only return popup when feature is clicked in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/make-esri-dijit-popup-only-return-popup-when/m-p/272204#M25085</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would second Steve's suggestion about tying the popup to a feature layer. For example, in one of my maps, I define the popup content at the beginning of my initMap() function like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; var removalTemplate = new esri.InfoTemplate();
 removalTemplate.setContent('&amp;lt;table cellspacing=\"5\" style=\"font-size:90%\"&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td style=\"vertical-align:top\"&amp;gt;&amp;lt;b&amp;gt;Road Name:&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td style=\"vertical-align:top\"&amp;gt;${Name}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td style=\"vertical-align:top\"&amp;gt;&amp;lt;b&amp;gt;Snow Removal Priority:&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td style=\"vertical-align:top\"&amp;gt;${Priority:formatPriorityLabel}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;');
 removalTemplate.setTitle('${Name}');&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Next, you specify the template when you create the feature layer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; // Define the Snow Removal Route layer
 theSnowRemovalLayer = new esri.layers.FeatureLayer("URL to feature layer", {
&amp;nbsp; mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
&amp;nbsp; infoTemplate:removalTemplate,
&amp;nbsp; outFields: ["*"],
&amp;nbsp; opacity:0.80,
&amp;nbsp; visible: false
 });&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Towards the end, but still within the initMap() function, I associate the popup with the specific feature layer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; dojo.connect(theSnowRemovalLayer,"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 = theSnowRemovalLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW);
&amp;nbsp; map.infoWindow.resize(map.width * 0.55,map.height * 0.25);&amp;nbsp; 
&amp;nbsp; map.infoWindow.setFeatures([deferred]);
&amp;nbsp; map.infoWindow.show(evt.mapPoint);
 });&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully that makes sense. Good luck!&lt;/SPAN&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 13:17:40 GMT</pubDate>
    <dc:creator>SteveCole</dc:creator>
    <dc:date>2021-12-11T13:17:40Z</dc:date>
    <item>
      <title>make esri.dijit.Popup only return popup when feature is clicked</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/make-esri-dijit-popup-only-return-popup-when/m-p/272201#M25082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a popup/infowindow that returns info for 2 of the layers in my map. However, when I click anywhere in the map the popup also comes up that says "no information available". Is there a way to disable this so that the popup only appears when a feature is clicked?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2012 11:29:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/make-esri-dijit-popup-only-return-popup-when/m-p/272201#M25082</guid>
      <dc:creator>CraigMcDade</dc:creator>
      <dc:date>2012-09-20T11:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: make esri.dijit.Popup only return popup when feature is clicked</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/make-esri-dijit-popup-only-return-popup-when/m-p/272202#M25083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How are you showing the popup?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm guessing it's designed to inform the user that there's nothing of interest at the location that they clicked.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2012 12:29:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/make-esri-dijit-popup-only-return-popup-when/m-p/272202#M25083</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2012-09-20T12:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: make esri.dijit.Popup only return popup when feature is clicked</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/make-esri-dijit-popup-only-return-popup-when/m-p/272203#M25084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a popup/infowindow that returns info for 2 of the layers in my map&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How are you calling the popup - what is causing the query to run? Are you running an &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/find_drilldown.html"&gt;IdentifyTask&lt;/A&gt;&lt;SPAN&gt;, for example?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Is there a way to disable this so that the popup only appears when a feature is clicked?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could associate an infoWindow with a &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/fl_ondemand.html"&gt;feature layer&lt;/A&gt;&lt;SPAN&gt;. In that case, the infoWindow will show when clicking on the feature. When you click away from a feature, nothing happens.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another option is to run a &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/query_showinfowindow.html"&gt;queryTask on click&lt;/A&gt;&lt;SPAN&gt;. If there are features found, display them in the infoWindow. If not, don't display the infoWindow.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2012 03:12:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/make-esri-dijit-popup-only-return-popup-when/m-p/272203#M25084</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2012-09-24T03:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: make esri.dijit.Popup only return popup when feature is clicked</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/make-esri-dijit-popup-only-return-popup-when/m-p/272204#M25085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would second Steve's suggestion about tying the popup to a feature layer. For example, in one of my maps, I define the popup content at the beginning of my initMap() function like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; var removalTemplate = new esri.InfoTemplate();
 removalTemplate.setContent('&amp;lt;table cellspacing=\"5\" style=\"font-size:90%\"&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td style=\"vertical-align:top\"&amp;gt;&amp;lt;b&amp;gt;Road Name:&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td style=\"vertical-align:top\"&amp;gt;${Name}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td style=\"vertical-align:top\"&amp;gt;&amp;lt;b&amp;gt;Snow Removal Priority:&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td style=\"vertical-align:top\"&amp;gt;${Priority:formatPriorityLabel}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;');
 removalTemplate.setTitle('${Name}');&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Next, you specify the template when you create the feature layer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; // Define the Snow Removal Route layer
 theSnowRemovalLayer = new esri.layers.FeatureLayer("URL to feature layer", {
&amp;nbsp; mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
&amp;nbsp; infoTemplate:removalTemplate,
&amp;nbsp; outFields: ["*"],
&amp;nbsp; opacity:0.80,
&amp;nbsp; visible: false
 });&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Towards the end, but still within the initMap() function, I associate the popup with the specific feature layer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; dojo.connect(theSnowRemovalLayer,"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 = theSnowRemovalLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW);
&amp;nbsp; map.infoWindow.resize(map.width * 0.55,map.height * 0.25);&amp;nbsp; 
&amp;nbsp; map.infoWindow.setFeatures([deferred]);
&amp;nbsp; map.infoWindow.show(evt.mapPoint);
 });&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully that makes sense. Good luck!&lt;/SPAN&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 13:17:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/make-esri-dijit-popup-only-return-popup-when/m-p/272204#M25085</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2021-12-11T13:17:40Z</dc:date>
    </item>
  </channel>
</rss>

