<?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: Search Widget (JSAPI 4.25) Event Handlers When Using Suggestions in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-jsapi-4-25-event-handlers-when-using/m-p/1238574#M79583</link>
    <description>&lt;P&gt;I'm not sure what changes you may have made, but if you only care about the selected result, you can just listen for the search-complete event, and ignore anything else.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#event-search-complete" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#event-search-complete&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Lots of changes between 3x and 4x, events are completely different.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2022 01:19:35 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2022-12-07T01:19:35Z</dc:date>
    <item>
      <title>Search Widget (JSAPI 4.25) Event Handlers When Using Suggestions</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-jsapi-4-25-event-handlers-when-using/m-p/1238533#M79579</link>
      <description>&lt;P&gt;In the process of migrating an app I had built using JSAPI 3.x&amp;nbsp; to 4.x.&lt;/P&gt;&lt;P&gt;Trying to understand why my 'Search' widget shows&amp;nbsp; following events for character as I enter them...&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;"search-focus"&lt;/LI&gt;&lt;LI&gt;"suggest-start"&lt;/LI&gt;&lt;LI&gt;"suggest_complete"&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Until I hit my "minCharaters" of 3 suggestion configured in the "SearchSources" and suggestions are displayed.&amp;nbsp;When I now click on one of the suggestions, I get events:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;"search-blur"&lt;/LI&gt;&lt;LI&gt;"search-focus"&lt;/LI&gt;&lt;LI&gt;"search-start"&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;But I never see a "search-complete" that would allow me to grab the selected records and its attributes. Instead I get an error:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Search.js:15 Uncaught TypeError: Cannot read properties of undefined (reading 'remove')
    at N.clearGraphics (Search.js:15:492)
    at N.search (Search.js:16:88)
    at D.search (Search.js:147:168)
    at D._handleSuggestionClick (Search.js:169:123)
    at Object.handleInterceptedEvent ((index):2486:380)
    at HTMLLIElement.&amp;lt;anonymous&amp;gt; ((index):2502:456)&lt;/LI-CODE&gt;&lt;P&gt;Since this looks graphics related, I made sure that I have&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;resultGraphicEnabled: false,&lt;/LI-CODE&gt;&lt;P&gt;in my Search() configuration. I had some custom CSS to tweak where this widget lives. But I rolled that back also and it seems to not have fixed things.&lt;/P&gt;&lt;P&gt;Any idea what might be going on here and why I'm seeing this graphics error? Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 22:34:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-jsapi-4-25-event-handlers-when-using/m-p/1238533#M79579</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2022-12-06T22:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget (JSAPI 4.25) Event Handlers When Using Suggestions</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-jsapi-4-25-event-handlers-when-using/m-p/1238544#M79580</link>
      <description>&lt;P&gt;Do you have a codepen or github repo sample of the issue? Are you trying go get the search result only after you select from suggestions? Or do you want the suggestions? A repro sample would help with your error. Here is the list of events on the Search widget&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#events-summary" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#events-summary&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 23:22:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-jsapi-4-25-event-handlers-when-using/m-p/1238544#M79580</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-12-06T23:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget (JSAPI 4.25) Event Handlers When Using Suggestions</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-jsapi-4-25-event-handlers-when-using/m-p/1238557#M79581</link>
      <description>&lt;P&gt;Thanks for chiming in, Rene! I find myself in good hands then!! &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm trying to replicate what I was doing in 3.x although the events seemed to have changed. I want to display the suggestions and then when you select one (click on it), I want to grab that record from the event.&lt;/P&gt;&lt;P&gt;From what I can tell, I was using "search-results" in 3.x with WebAppBuilder. That seems to have been dropped in favor of "search-complete"?&lt;/P&gt;&lt;P&gt;Don't have my code in a form that I can readily copy paste into CodePen. That would take some stripping down. What I find is that I can get Search() to work in a minimal app with just a Search widget. So it's not related to the service I'm searching or browser etc.&lt;/P&gt;&lt;P&gt;What I'm doing is putting the Search widget inside another DOM element that I'm adding to view.ui. That all works great and I get a widget and suggestions. So I see those other events triggered. (I took each documented event and tried to catch it. ) I suspect that the event handler tied to the &amp;lt;li&amp;gt; item in the &amp;lt;ul&amp;gt; of suggestions is messed up because of some CSS changes I made to arrange the Search window. Don't know what change that is specifically. But that's the only difference besides Search being wrapped in another HTML element that I can think of. So I would love to know how I can confirm this and find a work-around.&lt;/P&gt;&lt;P&gt;Of course, the error referencing some minified code doesn't help.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 00:27:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-jsapi-4-25-event-handlers-when-using/m-p/1238557#M79581</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2022-12-07T00:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget (JSAPI 4.25) Event Handlers When Using Suggestions</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-jsapi-4-25-event-handlers-when-using/m-p/1238574#M79583</link>
      <description>&lt;P&gt;I'm not sure what changes you may have made, but if you only care about the selected result, you can just listen for the search-complete event, and ignore anything else.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#event-search-complete" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#event-search-complete&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Lots of changes between 3x and 4x, events are completely different.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 01:19:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-jsapi-4-25-event-handlers-when-using/m-p/1238574#M79583</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-12-07T01:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget (JSAPI 4.25) Event Handlers When Using Suggestions</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-jsapi-4-25-event-handlers-when-using/m-p/1238575#M79584</link>
      <description>&lt;P&gt;The problem indicated by the error message occurs when accessing the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#graphics" target="_self"&gt;graphics&lt;/A&gt; property of the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html" target="_self"&gt;Search&lt;/A&gt; widget's &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#view" target="_self"&gt;view&lt;/A&gt; property.&amp;nbsp; Basically it's saying the view's graphics property is undefined.&amp;nbsp; I can only think of two cases where this could happen: (1) the view is not &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#ready" target="_self"&gt;ready&lt;/A&gt; when this occurs, or (2) the widget's view property is not set to an instance of &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html" target="_self"&gt;MapView&lt;/A&gt; (or &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html" target="_self"&gt;SceneView&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;When you create your Search widget, it probably looks something like:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var search = new Search({
    //etc
    view: view
    //etc
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;What are you passing to the view property?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 01:23:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-jsapi-4-25-event-handlers-when-using/m-p/1238575#M79584</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2022-12-07T01:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget (JSAPI 4.25) Event Handlers When Using Suggestions</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-jsapi-4-25-event-handlers-when-using/m-p/1238587#M79585</link>
      <description>&lt;P&gt;Thanks, guys!&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384"&gt;@ReneRubalcava&lt;/a&gt;&amp;nbsp;- well, "&lt;SPAN&gt;search-complete" is the one I'm having trouble with.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/6522"&gt;@JoelBennett&lt;/a&gt;&amp;nbsp;- Thank you! I understood the view property... but since I have my code spread over multiple JS files and am passing view into a function that sets up the Search(), your comment had me take another look and if I pass in a document.getElementById('viewDiv')... it works! I wasn't seeing the forest for the trees! I can sleep soundly now. Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 02:48:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-jsapi-4-25-event-handlers-when-using/m-p/1238587#M79585</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2022-12-07T02:48:06Z</dc:date>
    </item>
  </channel>
</rss>

