<?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: PopupTemplate override on KMLLayer in Javascript V4.26 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-override-on-kmllayer-in-javascript/m-p/1312923#M81807</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-KMLLayerView.html#allVisiblePoints" target="_self" rel="nofollow noopener noreferrer"&gt;allVisiblePoints&lt;/A&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-KMLLayerView.html#allVisiblePolylines" target="_self" rel="nofollow noopener noreferrer"&gt;allVisiblePolylines&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;or&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-KMLLayerView.html#allVisiblePolygons" target="_self" rel="nofollow noopener noreferrer"&gt;allVisiblePolygons&lt;/A&gt;&amp;nbsp;works thanks for the quick response&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jul 2023 02:19:15 GMT</pubDate>
    <dc:creator>MikeBehan</dc:creator>
    <dc:date>2023-07-28T02:19:15Z</dc:date>
    <item>
      <title>PopupTemplate override on KMLLayer in Javascript V4.26</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-override-on-kmllayer-in-javascript/m-p/1312404#M81801</link>
      <description>&lt;P&gt;I have been search for a way to override the popup template on a KMLLayer in the ESRI v4 api for a while with no luck. I am trying to avoid a rewrite of some functionality as we did not know all the&amp;nbsp; constraints on KMLLayers. We would like to preserve style but not showing the extended data or having a way to add actions to the popup is kinda a deal Breaker&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;I have tried providing a template on creation, have also add this template to allSublayers. I have&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;also tried overriding the popupTemplate manually on the layer.&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; const customButtonPopUp = {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; title: "sync",&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; id: "c-popup"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; };&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; const kmlLayer = new KMLLayer({&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; url: kmlFileUrl,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; title: sitetrackerLayer.Name,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sForceInfo: { Id: sitetrackerLayer.Id, Type: sitetrackerLayer.Type },&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; popupTemplate: new PopupTemplate({&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; title: "{Name}",&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; content: "{balloonStyleText}",&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; actions: [customButtonPopUp]&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; })&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; });&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; I have tried doing this manually on click by setting the content and disabling&amp;nbsp;the popupEnabled property&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; on the Layer&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;mapview.on("click", function(event) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mapview.hitTest(event).then(function(response) {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (response.results.length) {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; const graphic = response.results.filter(function (result) {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // check if the graphic belongs to the layer of interest&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return result.graphic.layer.uid === kmlLayer.uid;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; })[0].graphic;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; const attributes = graphic.attributes;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mapview.popup.content = `&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;b&amp;gt;${attributes.Name}&amp;lt;/b&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;br/&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ${attributes.Description}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;br/&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Custom content goes here&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; `;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mapview.popup.open({&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; title: "Custom Popup Title",&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; location: event.mapPoint&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any sample code or knowledge on whether this is possible would be be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 01:00:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-override-on-kmllayer-in-javascript/m-p/1312404#M81801</guid>
      <dc:creator>MikeBehan</dc:creator>
      <dc:date>2023-07-27T01:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: PopupTemplate override on KMLLayer in Javascript V4.26</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-override-on-kmllayer-in-javascript/m-p/1312785#M81805</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The first approach won't work. &amp;nbsp;KMLLayer has sublayers and we don't know about the sublayers. &amp;nbsp;So we can't define popupTemplate on the layer directly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second approach should work. You can disable the popupEnabled on the MapView.&lt;/P&gt;&lt;P&gt;However, you can set the popupTemplate&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;by accessing the graphics which can be accessed via &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-KMLLayerView.html#allVisiblePoints" target="_self"&gt;allVisiblePoints&lt;/A&gt;, &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-KMLLayerView.html#allVisiblePolylines" target="_self"&gt;allVisiblePolylines&lt;/A&gt; or &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-KMLLayerView.html#allVisiblePolygons" target="_self"&gt;allVisiblePolygons&lt;/A&gt;. The document is wrong these properties return collection of graphics not geometries. We will get the document correct. You&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;can watch the changes on these collections and change the popupTemplate on the graphics.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Here is a simple codepen that shows the worflow:&amp;nbsp;&lt;A href="https://codepen.io/U_B_U/pen/rNQqgxR?editors=0010" target="_blank" rel="noopener"&gt;https://codepen.io/U_B_U/pen/rNQqgxR?editors=0010&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 19:35:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-override-on-kmllayer-in-javascript/m-p/1312785#M81805</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2023-07-27T19:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: PopupTemplate override on KMLLayer in Javascript V4.26</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-override-on-kmllayer-in-javascript/m-p/1312923#M81807</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-KMLLayerView.html#allVisiblePoints" target="_self" rel="nofollow noopener noreferrer"&gt;allVisiblePoints&lt;/A&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-KMLLayerView.html#allVisiblePolylines" target="_self" rel="nofollow noopener noreferrer"&gt;allVisiblePolylines&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;or&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-KMLLayerView.html#allVisiblePolygons" target="_self" rel="nofollow noopener noreferrer"&gt;allVisiblePolygons&lt;/A&gt;&amp;nbsp;works thanks for the quick response&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 02:19:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-override-on-kmllayer-in-javascript/m-p/1312923#M81807</guid>
      <dc:creator>MikeBehan</dc:creator>
      <dc:date>2023-07-28T02:19:15Z</dc:date>
    </item>
  </channel>
</rss>

