<?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 KMLLayer - override click behavior in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/kmllayer-override-click-behavior/m-p/507129#M47172</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would like to implement custom behavior when clicking on KML features. I can do this for non-KML feature layers and raster layers, but for some reason KML is giving me fits. The desired click behavior is: 1) I don't want to show a popup (I have accomplished this in a very hacky way with CSS), 2) I would like to query the layer with a buffered point and hand the resulting features to a sidebar component for analysis and display. (I can only accomplish this by clicking near enough to the features to grab them, but if I click on a graphic icon, the event is routed to the invisible infoWindow or whatever.) Is there a way to disconnect the KMLLayer's (and nested layers') &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;onClick&lt;/SPAN&gt;&lt;SPAN&gt; event and supply my own event handler?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Apr 2013 19:21:56 GMT</pubDate>
    <dc:creator>DanielWalton</dc:creator>
    <dc:date>2013-04-26T19:21:56Z</dc:date>
    <item>
      <title>KMLLayer - override click behavior</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/kmllayer-override-click-behavior/m-p/507129#M47172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would like to implement custom behavior when clicking on KML features. I can do this for non-KML feature layers and raster layers, but for some reason KML is giving me fits. The desired click behavior is: 1) I don't want to show a popup (I have accomplished this in a very hacky way with CSS), 2) I would like to query the layer with a buffered point and hand the resulting features to a sidebar component for analysis and display. (I can only accomplish this by clicking near enough to the features to grab them, but if I click on a graphic icon, the event is routed to the invisible infoWindow or whatever.) Is there a way to disconnect the KMLLayer's (and nested layers') &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;onClick&lt;/SPAN&gt;&lt;SPAN&gt; event and supply my own event handler?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Apr 2013 19:21:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/kmllayer-override-click-behavior/m-p/507129#M47172</guid>
      <dc:creator>DanielWalton</dc:creator>
      <dc:date>2013-04-26T19:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: KMLLayer - override click behavior</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/kmllayer-override-click-behavior/m-p/507130#M47173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The easiest way I can think of to do this is to set each feature layer's info template to null. Something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.connect(kml, 'onLoad', function(lyr) {
&amp;nbsp; // set up event listeners on each layer that makes up the kml layer
&amp;nbsp; var layers = lyr.getLayers();
&amp;nbsp; dojo.forEach(layers, function(lyr) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.setInfoTemplate(null);
&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.connect(lyr, "onClick", function(e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do your on click stuff here
&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp; });
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works because the map popup (or info window) is driven by whether or not a feature has an info template. if a graphic (or a graphics layer, or a feature layer) doesn't have an info template then no popup will be shown when a graphic (feature) is clicked.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:14:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/kmllayer-override-click-behavior/m-p/507130#M47173</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2021-12-11T22:14:13Z</dc:date>
    </item>
  </channel>
</rss>

