<?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: on selection complete runs multiple times in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/on-selection-complete-runs-multiple-times/m-p/558416#M52092</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Linda,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Glad to help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Feb 2017 20:22:32 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2017-02-22T20:22:32Z</dc:date>
    <item>
      <title>on selection complete runs multiple times</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/on-selection-complete-runs-multiple-times/m-p/558413#M52089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a button that is being pressed to select features based on a query the user inputs. &amp;nbsp;The function works, but the on "selection-complete" part is firing multiple times. &amp;nbsp;When the button is clicked the first time, it fires once. &amp;nbsp;When it is clicked the second time, it fires twice, etc. &amp;nbsp;Is there any way to prevent this behavior? &amp;nbsp;I want to include more in the on complete function but cannot because it is looping multiple times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sites.selectFeatures(siteSelection, FeatureLayer.SELECTION_NEW);&lt;BR /&gt; // when selection is complete, zoom to the selected features&lt;BR /&gt; Sites.on("selection-complete", function(){ &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;map.setExtent(graphicsUtils.graphicsExtent(Sites.getSelectedFeatures()), true);&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where site selection is defined by:&lt;/P&gt;&lt;P&gt;siteSelection = new Query();&lt;BR /&gt; siteSelection.returnGeometry = true;&lt;BR /&gt; siteSelection.outFields = ["*"];&lt;/P&gt;&lt;P&gt;siteSelection.where = queryField + " LIKE '%" + queryText + "%'";&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2017 19:26:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/on-selection-complete-runs-multiple-times/m-p/558413#M52089</guid>
      <dc:creator>LindaDunklee</dc:creator>
      <dc:date>2017-02-22T19:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: on selection complete runs multiple times</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/on-selection-complete-runs-multiple-times/m-p/558414#M52090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Linda,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;It sounds like you are adding the on selection complete event handler in your code more than once then. The can sometimes happen when a developer mistakenly add the event handler inside a function that gets called more then once in their code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2017 19:52:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/on-selection-complete-runs-multiple-times/m-p/558414#M52090</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2017-02-22T19:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: on selection complete runs multiple times</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/on-selection-complete-runs-multiple-times/m-p/558415#M52091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I moved the on selection complete function outside of the function running on click of the button and it worked. &amp;nbsp;Thanks for the help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2017 20:19:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/on-selection-complete-runs-multiple-times/m-p/558415#M52091</guid>
      <dc:creator>LindaDunklee</dc:creator>
      <dc:date>2017-02-22T20:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: on selection complete runs multiple times</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/on-selection-complete-runs-multiple-times/m-p/558416#M52092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Linda,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Glad to help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2017 20:22:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/on-selection-complete-runs-multiple-times/m-p/558416#M52092</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2017-02-22T20:22:32Z</dc:date>
    </item>
  </channel>
</rss>

