<?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: LayerList Widget : Programatically filter layers? in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/layerlist-widget-programatically-filter-layers/m-p/862837#M11997</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much Robert for your help. It's working fine. I am using widget communication to publish corresponding filter data. Receiving it in layer list widget and applying above code to filter and update UI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers Prashant.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Feb 2019 04:33:31 GMT</pubDate>
    <dc:creator>PrashantKirpan</dc:creator>
    <dc:date>2019-02-04T04:33:31Z</dc:date>
    <item>
      <title>LayerList Widget : Programatically filter layers?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/layerlist-widget-programatically-filter-layers/m-p/862833#M11993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wanted to filter layers programatically in layer list widget. I developed a custom widget which allows to set layer visibility based on predefined criteria. I am able to manage that using below class.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;LayerStructure.getInstance();&lt;/P&gt;&lt;P&gt;..layerNode.Hide()\Show()&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;After that,I am trying to remove invisible layers from layer-list&amp;nbsp;widget but not sure what is the best way to handle this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to fire filter method programatically(same filter functionality) from other widget ? or remove layer from map?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prashant&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2019 07:21:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/layerlist-widget-programatically-filter-layers/m-p/862833#M11993</guid>
      <dc:creator>PrashantKirpan</dc:creator>
      <dc:date>2019-02-01T07:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList Widget : Programatically filter layers?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/layerlist-widget-programatically-filter-layers/m-p/862834#M11994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Prashant,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&amp;nbsp; &amp;nbsp;You would need get a reference to the LayerListWidget and then something like:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;LayerListWidget&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerListView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerFilter&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerInfoIsValidStatus&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;yourLayerInfo&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;id&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;false&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This is basically what the LayerList widgets filter does, except it does the opposite and sets the value to true for the layers whose title matches whats typed in the filter box.&lt;/P&gt;&lt;P&gt;Oh of course you need to call refresh on the widget.&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;LayerListWidget&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;_refresh&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2019 14:49:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/layerlist-widget-programatically-filter-layers/m-p/862834#M11994</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-02-01T14:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList Widget : Programatically filter layers?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/layerlist-widget-programatically-filter-layers/m-p/862835#M11995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for reply,as you suggested I have tried to filter layers but doesn't update list,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) To verify, i have added one button on layerlist view widget&amp;nbsp;and execute below code on click event but UI is not updating.No error in code execution.&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;_onBtnTestClicked: function () {&lt;/P&gt;&lt;P&gt;this.layerListView.layerFilter.layerInfoIsValidStatus["LayerId"] = true/false;&lt;BR /&gt;this._refresh();&lt;BR /&gt;},&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;2) Additionally,i called existing filter method on button click event but still no changes on UI. Code executed successfully.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;_onBtnTestClicked: function () {&lt;/P&gt;&lt;P&gt;this.layerFilter._onFilter("Filter criteria"); &lt;BR /&gt; },&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Do i need to call any function/event explicitly to update ui?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2019 23:58:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/layerlist-widget-programatically-filter-layers/m-p/862835#M11995</guid>
      <dc:creator>PrashantKirpan</dc:creator>
      <dc:date>2019-02-03T23:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList Widget : Programatically filter layers?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/layerlist-widget-programatically-filter-layers/m-p/862836#M11996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Prashant,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; OK, here is what I have tested to work.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;      _onBtnTestClicked&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        &lt;SPAN class="comment token"&gt;//this is the critial missing piece&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerFilter&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;isValid &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;true&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

        &lt;SPAN class="comment token"&gt;//for your first method&lt;/SPAN&gt;
        &lt;SPAN class="comment token"&gt;//loop though all the operational layers as set to true&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;operLayerInfos&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;traversalAll&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lang&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;hitch&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;layerInfo&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
          &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerFilter&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerInfoIsValidStatus&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;layerInfo&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;id&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;true&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="comment token"&gt;//now exclude the layer(s) you wish to hide&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerFilter&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerInfoIsValidStatus&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"LOJIC_PublicSafety_Louisville_2161"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;false&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="comment token"&gt;//Or your second method&lt;/SPAN&gt;
        &lt;SPAN class="comment token"&gt;// this.layerFilter._onFilter("Fire");&lt;/SPAN&gt;
        &lt;SPAN class="comment token"&gt;//as long as you have line 2 the filter will work&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerListView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;refresh&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:42:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/layerlist-widget-programatically-filter-layers/m-p/862836#M11996</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T10:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList Widget : Programatically filter layers?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/layerlist-widget-programatically-filter-layers/m-p/862837#M11997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much Robert for your help. It's working fine. I am using widget communication to publish corresponding filter data. Receiving it in layer list widget and applying above code to filter and update UI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers Prashant.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2019 04:33:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/layerlist-widget-programatically-filter-layers/m-p/862837#M11997</guid>
      <dc:creator>PrashantKirpan</dc:creator>
      <dc:date>2019-02-04T04:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList Widget : Programatically filter layers?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/layerlist-widget-programatically-filter-layers/m-p/862838#M11998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am creating custom widget for layerlist. In that widget created layers by using layerlist function. at the bottom of the widget i want to filter layers by using a textbox.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;keerthi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2020 11:19:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/layerlist-widget-programatically-filter-layers/m-p/862838#M11998</guid>
      <dc:creator>keerthiappasani</dc:creator>
      <dc:date>2020-06-12T11:19:17Z</dc:date>
    </item>
  </channel>
</rss>

