<?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: Jimu AdvancedSelect widget bug when using filter and isMultiple in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/jimu-advancedselect-widget-issue-when-using-filter/m-p/1544922#M15205</link>
    <description>&lt;P&gt;I don't know enough about AdvancedSelect to give an exact solution, but here's what's happening. The onClick() function fires every time a checkbox is changed. You are then passing that value into a useState() function. useState() will cause the component to re-render which wipes the filtering. You will need to capture the staticValues and store it in a piece of state so that you can access it after the re-render.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Oct 2024 19:16:52 GMT</pubDate>
    <dc:creator>JeffreyThompson2</dc:creator>
    <dc:date>2024-10-02T19:16:52Z</dc:date>
    <item>
      <title>Jimu AdvancedSelect widget issue when using filter and isMultiple</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/jimu-advancedselect-widget-issue-when-using-filter/m-p/1544910#M15204</link>
      <description>&lt;P&gt;I'm using the Jimu AdvancedSelect widget in an ExperienceBuilder 1.15 custom widget.&lt;/P&gt;&lt;P&gt;It mostly works, but when using the isMultiple=True option, and the user has a filter value, then when the user clicks an item to select it, the list immediately reverts to full unfiltered state, even though it should have remained in the specified filtered state.&amp;nbsp; This is extremely confusing for the user obviously.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Before clicking the "DWW Rainwise" item checkbox:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-10-02 112821.png" style="width: 326px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/116358i2B0C6E46D4790572/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-10-02 112821.png" alt="Screenshot 2024-10-02 112821.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Immediately after clicking the checkbox:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-10-02 112840.png" style="width: 541px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/116359iA4E00D88BE37B445/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-10-02 112840.png" alt="Screenshot 2024-10-02 112840.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code Snippet:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const [selectedLayers, setSelectedLayers] = useState([]);
const onClickLayerExplorer = (items) =&amp;gt; {
    setSelectedLayers(items);
}

&amp;lt;AdvancedSelect
    onChange={onClickLayerExplorer}
    placeholder='Click to Select Layers'
    sortValuesByLabel=true
    isMultiple=true
    selectedValues={selectedLayers}
    staticValues={layerList.layers
        .filter((layer, index) =&amp;gt; (category.ID == 0 || layer.category == category.ID))
        .map((layer, index) =&amp;gt; ({ label: layer.name, value: layer.index }))}
&amp;gt;
    {' '}
&amp;lt;/AdvancedSelect&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 23:03:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/jimu-advancedselect-widget-issue-when-using-filter/m-p/1544910#M15204</guid>
      <dc:creator>EmoryHorvath</dc:creator>
      <dc:date>2024-10-02T23:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Jimu AdvancedSelect widget bug when using filter and isMultiple</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/jimu-advancedselect-widget-issue-when-using-filter/m-p/1544922#M15205</link>
      <description>&lt;P&gt;I don't know enough about AdvancedSelect to give an exact solution, but here's what's happening. The onClick() function fires every time a checkbox is changed. You are then passing that value into a useState() function. useState() will cause the component to re-render which wipes the filtering. You will need to capture the staticValues and store it in a piece of state so that you can access it after the re-render.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 19:16:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/jimu-advancedselect-widget-issue-when-using-filter/m-p/1544922#M15205</guid>
      <dc:creator>JeffreyThompson2</dc:creator>
      <dc:date>2024-10-02T19:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: Jimu AdvancedSelect widget bug when using filter and isMultiple</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/jimu-advancedselect-widget-issue-when-using-filter/m-p/1545003#M15208</link>
      <description>&lt;P&gt;Okay, yes, that was what i suspected was probably happening.&amp;nbsp; Good.&amp;nbsp; Note that it doesn't completely wipe out the filtering because the filter value is still displayed in the filter box.&lt;/P&gt;&lt;P&gt;But i think the suggested solution is hairy and even if i got it to work somehow, i think it'd then break the filtering because now the filtering is pulling from this new filtered staticValues instead of from the full list.&lt;/P&gt;&lt;P&gt;So i tried something a little different instead.&amp;nbsp; You see from the way i'm setting the staticValues property that i'm actually generating &amp;amp; assigning a new staticValues object for each re-render.&amp;nbsp; I suspected that might be confusing the widget, so i changed my code to generate the item list only once at startup and then just assign the same list (same object reference) to staticValues each re-render.&amp;nbsp; And now things seem to be working.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 22:27:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/jimu-advancedselect-widget-issue-when-using-filter/m-p/1545003#M15208</guid>
      <dc:creator>EmoryHorvath</dc:creator>
      <dc:date>2024-10-02T22:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Jimu AdvancedSelect widget bug when using filter and isMultiple</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/jimu-advancedselect-widget-issue-when-using-filter/m-p/1555006#M15775</link>
      <description>&lt;P&gt;That's great to hear that it's working.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 07:27:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/jimu-advancedselect-widget-issue-when-using-filter/m-p/1555006#M15775</guid>
      <dc:creator>Ke_Xu</dc:creator>
      <dc:date>2024-11-04T07:27:05Z</dc:date>
    </item>
  </channel>
</rss>

