<?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 Search Widget possible to cancel or abort a search? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-possible-to-cancel-or-abort-a-search/m-p/1228428#M79235</link>
    <description>&lt;P&gt;Wondering if it's possible to cancel a search within the search widget (ArcGIS JavaScript API 4.24) based on the text in the search widget text area before it is sent to an online source?&lt;/P&gt;&lt;P&gt;I'm able to trap the search when it starts, but there isn't an event to cancel/abort from yet. I don't want to use the 'search-complete' event since it's already too late at that point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;searchWidget.on("search-start", function (event) {
    if (searchWidget.searchTerm == "my search term") {
        //Cancel the search
    }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal is to interrogate the search string for a specific value and cancel the search to perform a different action.&amp;nbsp; TLDR: Would like to listen for a local coordinate input x,y using a regex. If matches the pattern, don't send a search, just pan/zoom the map (since map is in a local coordinate system as well). I've also looked at reactiveUltils, but can't seem to figure out how to cancel the search.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Nov 2022 17:47:24 GMT</pubDate>
    <dc:creator>BryanMc</dc:creator>
    <dc:date>2022-11-03T17:47:24Z</dc:date>
    <item>
      <title>Search Widget possible to cancel or abort a search?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-possible-to-cancel-or-abort-a-search/m-p/1228428#M79235</link>
      <description>&lt;P&gt;Wondering if it's possible to cancel a search within the search widget (ArcGIS JavaScript API 4.24) based on the text in the search widget text area before it is sent to an online source?&lt;/P&gt;&lt;P&gt;I'm able to trap the search when it starts, but there isn't an event to cancel/abort from yet. I don't want to use the 'search-complete' event since it's already too late at that point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;searchWidget.on("search-start", function (event) {
    if (searchWidget.searchTerm == "my search term") {
        //Cancel the search
    }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal is to interrogate the search string for a specific value and cancel the search to perform a different action.&amp;nbsp; TLDR: Would like to listen for a local coordinate input x,y using a regex. If matches the pattern, don't send a search, just pan/zoom the map (since map is in a local coordinate system as well). I've also looked at reactiveUltils, but can't seem to figure out how to cancel the search.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 17:47:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-possible-to-cancel-or-abort-a-search/m-p/1228428#M79235</guid>
      <dc:creator>BryanMc</dc:creator>
      <dc:date>2022-11-03T17:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget possible to cancel or abort a search?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-possible-to-cancel-or-abort-a-search/m-p/1228444#M79239</link>
      <description>&lt;P&gt;One option would be to use RequestInterceptor to inspect the search and modify it before sending it to the geocoding service (or doing something else entirely).&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#RequestInterceptor" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#RequestInterceptor&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 18:22:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-possible-to-cancel-or-abort-a-search/m-p/1228444#M79239</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2022-11-03T18:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget possible to cancel or abort a search?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-possible-to-cancel-or-abort-a-search/m-p/1228782#M79246</link>
      <description>&lt;P&gt;Thank you Noah! This doesn't cancel the search but it does allow me intercept and do whatever I want. Just need to craft my own return object once done to finish the bypass process.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I return back my own random object, the Search Widget will say "No Results". But if I return my own custom search result object it can pan/zoom and still look like a completed search. In 3x we could cancel the request and take over - so without that option in 4x, this is definitely the way to go.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 15:31:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-possible-to-cancel-or-abort-a-search/m-p/1228782#M79246</guid>
      <dc:creator>BryanMc</dc:creator>
      <dc:date>2022-11-04T15:31:00Z</dc:date>
    </item>
  </channel>
</rss>

