<?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: WebApp display layer only if filtered? in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/webapp-display-layer-only-if-filtered/m-p/244237#M6596</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Robert, that should work!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Sep 2018 16:53:57 GMT</pubDate>
    <dc:creator>StefFrat</dc:creator>
    <dc:date>2018-09-11T16:53:57Z</dc:date>
    <item>
      <title>WebApp display layer only if filtered?</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/webapp-display-layer-only-if-filtered/m-p/244235#M6594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, hoping for some help!&amp;nbsp; Can I make a webapp with layers that can only be viewed when a filter is applied?&amp;nbsp; So instead of "No Filter"&amp;nbsp;showing all the data, it would show no data.&amp;nbsp; I have a dataset where features have the same locations, and it only makes sense to view this data when a filter is applied.&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example (this is not my application) is a&amp;nbsp;point layer&amp;nbsp;of&amp;nbsp;different cars I might buy, and a webapp&amp;nbsp;that lets me see what&amp;nbsp;my driveway would look like with one new car occupying the only available spot in my driveway.&amp;nbsp; The layer would have points for&amp;nbsp;a car, a truck,&amp;nbsp;and a van, all with the same XY coords, symbolized differently, and the view of the webapp only makes sense when you are filtered to view one and only one of these cars, because if you don't filter, you see a jumbled mess of car symbols on top of the same X, and instead of that mess&amp;nbsp;you'd rather see the empty spot until you pick one.&amp;nbsp; Hoping to stay near the simplicity of the WebApp builder, and want something as simple as the Filter widget.&amp;nbsp; Thanks!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2018 00:23:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/webapp-display-layer-only-if-filtered/m-p/244235#M6594</guid>
      <dc:creator>StefFrat</dc:creator>
      <dc:date>2018-09-08T00:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: WebApp display layer only if filtered?</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/webapp-display-layer-only-if-filtered/m-p/244236#M6595</link>
      <description>&lt;P&gt;Stef,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;This is possible if you are using WAB Developer edition and make some code changes to the Widget.js.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add lines 4-9 to the startup function:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;      startup: function() {
        this.inherited(arguments);
        this.resize();
        //Initialy turn all filter layers off
        var filters = this.config.filters;
        array.forEach(filters, lang.hitch(this, function(filterObj) {
          var lyrInfo = this.layerInfosObj.getLayerInfoById(filterObj.layerId);
          lyrInfo.hide();
        }));
      },‍‍‍‍‍‍‍‍‍‍&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add lines 27, 35&amp;nbsp;and 41 to the toggleFilter function:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;      toggleFilter: function(node, filterObj, parse) {

        if (html.hasClass(node, 'config-parameters') &amp;amp;&amp;amp;
          !(node.filterParams &amp;amp;&amp;amp; node.filterParams.getFilterExpr())) {
          return;
        }
        if (parse.isAskForValue &amp;amp;&amp;amp; !(node.filterParams &amp;amp;&amp;amp; node.filterParams.getFilterExpr())) {
          this.configFilter(node, filterObj);
          return;
        }
        // if(node.toggleButton.isDoing){
        //   return;
        // }

        var layerId = filterObj.layerId;
        var idx = html.getAttr(node, 'data-index');
        var layerFilterExpr = null;

        var applied = html.hasClass(node, 'applied');
        if (applied) {
          html.removeClass(node, 'applied');
          node.toggleButton.uncheck();
        } else {
          html.addClass(node, 'applied');
          node.toggleButton.check();
        }
        var lyrInfo = this.layerInfosObj.getLayerInfoById(filterObj.layerId);
        var enableMapFilter = null;
        if (!applied) {
          var expr = this._getFilterExpr(node, filterObj);
          this._setItemFilter(layerId, idx, expr, filterObj.enableMapFilter);
          layerFilterExpr = this._getExpr(layerId);
          enableMapFilter = this._getMapFilterControl(layerId);
          this.filterManager.applyWidgetFilter(layerId, this.id, layerFilterExpr, enableMapFilter);
          lyrInfo.show();
        } else {
          this._removeItemFilter(layerId, idx);
          layerFilterExpr = this._getExpr(layerId);
          enableMapFilter = this._getMapFilterControl(layerId);
          this.filterManager.applyWidgetFilter(layerId, this.id, layerFilterExpr, enableMapFilter);
          lyrInfo.hide();
        }

        this._afterFilterApplied(filterObj.layerId);
      },‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 16:16:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/webapp-display-layer-only-if-filtered/m-p/244236#M6595</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-06-22T16:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: WebApp display layer only if filtered?</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/webapp-display-layer-only-if-filtered/m-p/244237#M6596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Robert, that should work!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2018 16:53:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/webapp-display-layer-only-if-filtered/m-p/244237#M6596</guid>
      <dc:creator>StefFrat</dc:creator>
      <dc:date>2018-09-11T16:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: WebApp display layer only if filtered?</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/webapp-display-layer-only-if-filtered/m-p/244238#M6597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2018 17:13:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/webapp-display-layer-only-if-filtered/m-p/244238#M6597</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2018-09-11T17:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: WebApp display layer only if filtered?</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/webapp-display-layer-only-if-filtered/m-p/1070959#M21001</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello. Would this solution also work for the Group Filter widget? Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 13:58:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/webapp-display-layer-only-if-filtered/m-p/1070959#M21001</guid>
      <dc:creator>AndrewL</dc:creator>
      <dc:date>2021-06-22T13:58:16Z</dc:date>
    </item>
  </channel>
</rss>

