<?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: Button to Zoom and show popup in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262937#M24384</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Shane,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I got something like this working. In my app, it's a picklist where the user picks or types an asset, the app queries the appropreate layers for that asset and then the map zooms to that location, highlights the asset and displays the popup with any features returned by the query task. See this post - &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/84514-Launch-webmap-popup-programmatically"&gt;http://forums.arcgis.com/threads/84514-Launch-webmap-popup-programmatically&lt;/A&gt;&lt;SPAN&gt;. I just replyed to someone else about this same issue so it may be useful...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The trick is that you have to create an infotemplate that looks like the default popup. As you mentioned, you do use map.infowindow..show(screenpoint); (or map.popup.show as case might be). However, if you have not defined the infoTemplate and applied it to the feature(s), the popup will not display.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Jul 2013 20:57:45 GMT</pubDate>
    <dc:creator>ZorbaConlen</dc:creator>
    <dc:date>2013-07-08T20:57:45Z</dc:date>
    <item>
      <title>Button to Zoom and show popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262936#M24383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi been stuck on this for a few days.&amp;nbsp; What I am trying to do is when someone clicks on a button the map zooms to the specified extent then also displays a points popup in that extent.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Currently, on click of the button the map zooms to the correct extent, and the point is visible, but the popup does not display.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help or direction would be appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My button is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;HTML Button&lt;/STRONG&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&amp;lt;div dojoType="dijit.form.Button" id="NewZealandAuckland" iconClass="NewZealandAuckland" onClick="ZoomToNewZealandAuckland();"&amp;gt;Auckland&amp;lt;/div&amp;gt;
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This links to the button to display the extent.&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;Javascript extent&lt;/STRONG&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
function ZoomToNewZealandAuckland() {&amp;nbsp; 
var customExtent = new esri.geometry.Extent(174.756,-36.857,174.763,-36.852,new esri.SpatialReference({"wkid":4326}));
map.setExtent(customExtent);
}
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;Point&lt;/STRONG&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; 
var Auckland = new esri.geometry.Point(174.758, -36.855, new esri.SpatialReference({ 'wkid': 4326 }));
map.graphics.add(new esri.Graphic( esri.geometry.geographicToWebMercator(Auckland),
new esri.symbol.SimpleMarkerSymbol( {"angle":1,"xoffset":0,"yoffset":0,"type":"esriPMS","url":"http://static.arcgis.com/images/Symbols/Basic/BlueStickpin.png","imageData":"","contentType":"image/png","width":24,"height":24} ), 
{ 'title': '', 'content': ' },
new esri.InfoTemplate('${title}', '${content}')
));
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a feeling popup.show(); might be involved in the zoom to extent, but unsure how to use.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jul 2013 01:03:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262936#M24383</guid>
      <dc:creator>ShaneHogg</dc:creator>
      <dc:date>2013-07-06T01:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Button to Zoom and show popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262937#M24384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Shane,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I got something like this working. In my app, it's a picklist where the user picks or types an asset, the app queries the appropreate layers for that asset and then the map zooms to that location, highlights the asset and displays the popup with any features returned by the query task. See this post - &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/84514-Launch-webmap-popup-programmatically"&gt;http://forums.arcgis.com/threads/84514-Launch-webmap-popup-programmatically&lt;/A&gt;&lt;SPAN&gt;. I just replyed to someone else about this same issue so it may be useful...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The trick is that you have to create an infotemplate that looks like the default popup. As you mentioned, you do use map.infowindow..show(screenpoint); (or map.popup.show as case might be). However, if you have not defined the infoTemplate and applied it to the feature(s), the popup will not display.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 20:57:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262937#M24384</guid>
      <dc:creator>ZorbaConlen</dc:creator>
      <dc:date>2013-07-08T20:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Button to Zoom and show popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262938#M24385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Zconlen, Thanks for getting back to me, I am messing around with the code you supplied, but getting a bit stuck.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So far my geomerty point is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
////////////////AUCKLAND
var Auckland = new esri.geometry.Point(174.758, -36.855, new esri.SpatialReference({ 'wkid': 4326 }));
map.graphics.add(new esri.Graphic(esri.geometry.geographicToWebMercator(Auckland), // geometry
new esri.symbol.SimpleMarkerSymbol( {"angle":1,"xoffset":1,"yoffset":6,"type":"esriPMS","url":"http://static.arcgis.com/images/Symbols/Basic/BlueStickpin.png","imageData":"","contentType":"image/png","width":24,"height":24} ), 
// symbol
{ 'title': 'TITLE', 'content': 'CONTENT' }, // attributes
new esri.InfoTemplate ('${title}', '${content}')
));
*&lt;/PRE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and I have added your code into my zoom to extent which is called from a HTML Button.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

function ZoomToNewZealandAuckland() {
var customExtentAndSR = new esri.geometry.Extent(174.756,-36.857,174.763,-36.852,new esri.SpatialReference({"wkid":4326}));
map.setExtent(customExtentAndSR);
var extent = map.extent;
if(extent.contains(graphic.geometry)) {
//Use html to mimic look and feel of default webmap popup
//Use html to mimic look and feel of default webmap popup
var infoTemplate = new esri.InfoTemplate("test", "&amp;lt;div id='Popup'&amp;gt;&amp;lt;strong&amp;gt;${title}&amp;lt;/strong&amp;gt;&amp;lt;hr&amp;gt;&amp;lt;table cellpadding='5'&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;td&amp;gt;${content}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;");
//call defineInfoTemplate func, to apply above infoTemplate to features
defineInfoTemplate(Auckland, infoTemplate);
//set infowindow features to full array
map.infoWindow.setFeatures(Auckland);
//text for title bar
map.infoWindow.setTitle('+ title +');
// zoom map
map.infoWindow.show(Auckland); 
}

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Everything works fine but no infowindow.&amp;nbsp; This is my first esri Javascript so feeling quite lost.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for you help! much appreciated&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:53:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262938#M24385</guid>
      <dc:creator>ShaneHogg</dc:creator>
      <dc:date>2021-12-11T12:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Button to Zoom and show popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262939#M24386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So, it looks like you want to hard code the button to always zoom to the same feature (Aukland), and show the popup. Is that right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code I provided is for a very different case (dynamically show one or more features in the popup based on user selection), so not necessarily applicable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A couple things to look at though:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;defineInfoTemplate is not a method in the api. Its a function I created. You probably dont need it for your purposes, but if you try to call it, and it does not exist, that will be a problem. Instead you should use something like &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;graphic.setInfoTemplate(infoTemplate);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the setFeatures method expects a graphic and it looks to me like you are passing in a point. Try passing in a variable which points to the desired graphic.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 23:52:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262939#M24386</guid>
      <dc:creator>ZorbaConlen</dc:creator>
      <dc:date>2013-07-08T23:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: Button to Zoom and show popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262940#M24387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey thanks for the help, I am getting closer to the solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The following code will zoom to the extent, display a point, and a infowindow, however I want to try and link it to the infowindow I have already defined as default (currently opens up a blank popup).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
function ZoomToNewZealandAuckland() { 
var Auckland = new esri.geometry.Point(174.75815, -36.85515, new esri.SpatialReference({ 'wkid': 4326 }));
map.graphics.add(new esri.Graphic(
esri.geometry.geographicToWebMercator(Auckland), // geometry
new esri.symbol.SimpleMarkerSymbol( {"angle":1,"xoffset":1,"yoffset":6,"type":"esriPMS","url":"http://static.arcgis.com/images/Symbols/Basic/BlueStickpin.png","imageData":"","contentType":"image/png","width":32,"height":32} ), 
// symbol
{ 'title': 'TITLE', 'Content: 'CONTENT' }, // attributes
new esri.InfoTemplate('${title}', '${content}')
));
var customExtentAndSR = new esri.geometry.Extent(174.756,-36.857,174.763,-36.852,new esri.SpatialReference({"wkid":4326}));
map.setExtent(customExtentAndSR);
map.infoWindow.show(Auckland);
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe if i turn my "new esri.InfoTemplate('${title}', '${content}')" into a variable amd link it to "map.infoWindow.show(Auckland);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Shane H&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:53:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262940#M24387</guid>
      <dc:creator>ShaneHogg</dc:creator>
      <dc:date>2021-12-11T12:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Button to Zoom and show popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262941#M24388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sounds like the graphic still does not have an infotemplate defined. Maybe try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;...
var infoTemplate = new esri.InfoTemplate("title", "some content");
Auckland.setInfoTemplate(infoTemplate);
map.infoWindow.show(Auckland);
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:53:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262941#M24388</guid>
      <dc:creator>ZorbaConlen</dc:creator>
      <dc:date>2021-12-11T12:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Button to Zoom and show popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262942#M24389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey, I managed to figure it out yesterday.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The result is thus, when zooming on custom buttons the info template is displayed, clicking on other points or other zoom buttons cancels the infotemplate open and opens the correct one for that extent or clicked point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the idea of creating 2 infotemplates from your previous post, that was 1/2 the problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for you help&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;zconlen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jul 2013 19:39:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/button-to-zoom-and-show-popup/m-p/262942#M24389</guid>
      <dc:creator>ShaneHogg</dc:creator>
      <dc:date>2013-07-09T19:39:12Z</dc:date>
    </item>
  </channel>
</rss>

