<?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 LayerList: Combining custom filters with built-in search filter? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-combining-custom-filters-with-built-in/m-p/1682481#M88118</link>
    <description>&lt;P&gt;How do you combine custom filters (using the LayerList's `filterPredicate`) with the built-in search bar filter?&lt;/P&gt;&lt;P&gt;In a project using the LayerList component (using v4.33 for both core and map-components), I show the built-in search bar filter using `show-filter`, and I also provide toggleable custom filters. The setup is something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;arcgis-layer-list show-filter&amp;gt;&amp;lt;/arcgis-layer-list&amp;gt;
&amp;lt;button id="show-visible-only" aria-pressed="false"&amp;gt;
  Show only visible layers
&amp;lt;/button&amp;gt;

&amp;lt;script type="module"&amp;gt;
  const layerList = document.querySelector('arcgis-layer-list');
  const filterButton = document.getElementById('show-visible-only');

  const showVisibleOnlyPredicate = (item) =&amp;gt; item.visible;

  filterButton.addEventListener('click', (event) =&amp;gt; {
    const isPressed = filterButton.getAttribute('aria-pressed') === "true";
    if (isPressed) {
      layerList.filterPredicate = null; // null is the default
    } else {
      layerList.filterPredicate = showVisibleOnlyPredicate
    }
  });
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;The problem is that setting `layerList.filterPredicate` overrides the default search behavior. The built-in filter search bar does not work while a `filterPredicate` is defined.&lt;/U&gt; &lt;STRONG&gt;Am I doing something wrong, or is this just the way it works?&lt;/STRONG&gt; If the latter, I would appreciate a fix, as this seems like a bug.&lt;/P&gt;&lt;P&gt;I could probably find a way to re-implement the built-in search bar behavior and add it to `filterPredicate` manually (I already have a system for allowing multiple custom filters simultaneously), but it seems like this should work on its own.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Feb 2026 18:41:06 GMT</pubDate>
    <dc:creator>fdeters</dc:creator>
    <dc:date>2026-02-05T18:41:06Z</dc:date>
    <item>
      <title>LayerList: Combining custom filters with built-in search filter?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-combining-custom-filters-with-built-in/m-p/1682481#M88118</link>
      <description>&lt;P&gt;How do you combine custom filters (using the LayerList's `filterPredicate`) with the built-in search bar filter?&lt;/P&gt;&lt;P&gt;In a project using the LayerList component (using v4.33 for both core and map-components), I show the built-in search bar filter using `show-filter`, and I also provide toggleable custom filters. The setup is something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;arcgis-layer-list show-filter&amp;gt;&amp;lt;/arcgis-layer-list&amp;gt;
&amp;lt;button id="show-visible-only" aria-pressed="false"&amp;gt;
  Show only visible layers
&amp;lt;/button&amp;gt;

&amp;lt;script type="module"&amp;gt;
  const layerList = document.querySelector('arcgis-layer-list');
  const filterButton = document.getElementById('show-visible-only');

  const showVisibleOnlyPredicate = (item) =&amp;gt; item.visible;

  filterButton.addEventListener('click', (event) =&amp;gt; {
    const isPressed = filterButton.getAttribute('aria-pressed') === "true";
    if (isPressed) {
      layerList.filterPredicate = null; // null is the default
    } else {
      layerList.filterPredicate = showVisibleOnlyPredicate
    }
  });
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;The problem is that setting `layerList.filterPredicate` overrides the default search behavior. The built-in filter search bar does not work while a `filterPredicate` is defined.&lt;/U&gt; &lt;STRONG&gt;Am I doing something wrong, or is this just the way it works?&lt;/STRONG&gt; If the latter, I would appreciate a fix, as this seems like a bug.&lt;/P&gt;&lt;P&gt;I could probably find a way to re-implement the built-in search bar behavior and add it to `filterPredicate` manually (I already have a system for allowing multiple custom filters simultaneously), but it seems like this should work on its own.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Feb 2026 18:41:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-combining-custom-filters-with-built-in/m-p/1682481#M88118</guid>
      <dc:creator>fdeters</dc:creator>
      <dc:date>2026-02-05T18:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList: Combining custom filters with built-in search filter?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-combining-custom-filters-with-built-in/m-p/1682592#M88119</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/710429"&gt;@fdeters&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I think all you would need to do is add some logic to grab the `filterText` property value and add it to the filterPredicate.&amp;nbsp; Something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const showVisibleOnlyPredicate = (item) =&amp;gt; {
        if (item.visible &amp;amp;&amp;amp;  item.title.toLowerCase().includes(layerList.filterText.toLowerCase())) {
          return item
        };
      }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Played around with it here but I used a calcite switch and it seems to work&lt;BR /&gt;&lt;A href="https://codepen.io/sagewall/pen/pvbZmWL?editors=1000" target="_blank" rel="noopener"&gt;https://codepen.io/sagewall/pen/pvbZmWL?editors=1000&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Feb 2026 23:01:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-combining-custom-filters-with-built-in/m-p/1682592#M88119</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2026-02-05T23:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList: Combining custom filters with built-in search filter?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-combining-custom-filters-with-built-in/m-p/1682921#M88124</link>
      <description>&lt;P&gt;Argh, I was hoping to avoid re-implementing the built-in filter logic &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; This does work as a solution though, thanks.&lt;/P&gt;&lt;P&gt;As an aside: I noticed that `arcgisPropertyChange` event doesn't fire when `LayerList.filterText` changes. And it might only fire when `state` changes? Anyways, IDK what the design philosophy is there, maybe there's a good reason to not fire a million events, but it is confusing that `state` is the only one included right now.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Feb 2026 23:16:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-combining-custom-filters-with-built-in/m-p/1682921#M88124</guid>
      <dc:creator>fdeters</dc:creator>
      <dc:date>2026-02-06T23:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList: Combining custom filters with built-in search filter?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-combining-custom-filters-with-built-in/m-p/1682931#M88125</link>
      <description>&lt;P&gt;Yeah, your correct.&amp;nbsp; &lt;A href="https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-layer-list/#arcgisPropertyChange" target="_self"&gt;arcgisPropertyChange&lt;/A&gt; currently is only wired up to the `state` property on the layer list. You can see the properties wired up in the return type in the doc.&amp;nbsp; &amp;nbsp;We've tried to be conservative in which properties are included for the reason you pointed out, but it's pretty easy to add properties to the event if we get a good business case.&amp;nbsp; We'll consider adding `filterText` in a future release.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Feb 2026 00:18:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-combining-custom-filters-with-built-in/m-p/1682931#M88125</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2026-02-07T00:18:28Z</dc:date>
    </item>
  </channel>
</rss>

