<?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 Best practice for multiple types of IDENTIFY in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/best-practice-for-multiple-types-of-identify/m-p/561708#M52434</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here's what I'm dealing with:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have map and a toolbar ... regular CLICK on map will do an IdentifyTask on the VISIBLE layers...&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;From the toolbar I have a tool that, when selected, a different IdentifyTask is launched...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To handle the different actions to take according to the tool selected I have a select-case according to the selected tool on the click event, do I have to do the SAME (a select case according to the tool selected) on the identify results??&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Jan 2013 11:52:39 GMT</pubDate>
    <dc:creator>WalterEralio</dc:creator>
    <dc:date>2013-01-16T11:52:39Z</dc:date>
    <item>
      <title>Best practice for multiple types of IDENTIFY</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/best-practice-for-multiple-types-of-identify/m-p/561708#M52434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here's what I'm dealing with:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have map and a toolbar ... regular CLICK on map will do an IdentifyTask on the VISIBLE layers...&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;From the toolbar I have a tool that, when selected, a different IdentifyTask is launched...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To handle the different actions to take according to the tool selected I have a select-case according to the selected tool on the click event, do I have to do the SAME (a select case according to the tool selected) on the identify results??&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jan 2013 11:52:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/best-practice-for-multiple-types-of-identify/m-p/561708#M52434</guid>
      <dc:creator>WalterEralio</dc:creator>
      <dc:date>2013-01-16T11:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Best practice for multiple types of IDENTIFY</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/best-practice-for-multiple-types-of-identify/m-p/561709#M52435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Let me see if I follow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You have two identify tasks, one triggered by a map click at all times and one triggered by a button then a map click, correct?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since both are triggered by a map click, in the map click handler you check to see what state you are in?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
connect.connect(map, 'onClick', function(e){
 if (ID_STATE = 'DEFAULT') {
&amp;nbsp; // execute =idtask1
 } else if (ID_STATE == 'BUTTON_CLICK') {
&amp;nbsp; // execute idtask2
 }
});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does each identify task have it's own handler or are you passing the same handler function to each Identify Task?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you need to process the results differently, then yes you would need to do the same, but if that's the case, then I suggest a different handler per Identify Task.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But, if you are handling your clicks this way, might a suggest a different method. This actually has worked since the API moved to Dojo 1.7, I just didn't have a real need for it until earlier this week.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dojo has a dojo/on method that works on all dom events. Since the map is a dom element and has a click event, this will work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://dojotoolkit.org/reference-guide/1.8/dojo/on.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://dojotoolkit.org/reference-guide/1.8/dojo/on.html&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a sample working with a map&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://gist.github.com/4542944" rel="nofollow noopener noreferrer" target="_blank"&gt;https://gist.github.com/4542944&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So in your case you could do something like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var handler1 = on.pausable(map, 'click', function() {
 // stuff
 idtask1.execute(/*stuff*/);
});

on(button, 'click', function() {
 // here's the cool part, this event only happens one time
 var id_handler = on.once(map, 'click', function() {
&amp;nbsp; idtask2.execute(params, function() {
&amp;nbsp;&amp;nbsp; /** handle results **/
&amp;nbsp;&amp;nbsp; handler1.resume(); // turn the default map click handler back on
&amp;nbsp; });
 });
});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Add in an error handler to resume default map click events and you are good to go.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:13:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/best-practice-for-multiple-types-of-identify/m-p/561709#M52435</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-12-12T00:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Best practice for multiple types of IDENTIFY</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/best-practice-for-multiple-types-of-identify/m-p/561710#M52436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;WOW.. thanks for the quick answer.. and yes.. both identify had their own handler&amp;nbsp; (but I merged them to 1 and now working with the switch case option... however I'll try the dojo on function this afternoon..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jan 2013 16:48:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/best-practice-for-multiple-types-of-identify/m-p/561710#M52436</guid>
      <dc:creator>WalterEralio</dc:creator>
      <dc:date>2013-01-16T16:48:40Z</dc:date>
    </item>
  </channel>
</rss>

