featureLayerView.filter returning undefined after click

394
1
Jump to solution
09-29-2022 02:29 PM
UalasRohrer
New Contributor III

Hello, the following code filters all the featureLayerViews in the Map View. But, once I click on the map, the featureLayerView.filter returns undefined, and all the layers that were filtered out start to appear again. It doesn't have this behavior while using this code on a simple Javascript API 4.25 app, but, while using it in an Experience Builder 1.4 (API 4.21), it does. Any suggestions?

 

 

 

      var layers = jmv.view.layerViews.items
      layers.forEach(function(layer) {
        jmv.view.whenLayerView(layer.layer).then(async (layerView) => {
          await watchUtils.whenFalseOnce(layerView, "updating");
          layerView.filter = {
            where: `FirstYear_s <= 100 and LastYear_s >= 100`
          };
          
        });
      });

 

 

 

 

I'm using the following documentations: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLayerView.htm... and https://www.somalia-gis.org/arcgis_js_api/sdk/latest/guide/filter-a-feature-layer/

Thanks,
Ualas

0 Kudos
1 Solution

Accepted Solutions
UalasRohrer
New Contributor III

I just notice that this issue doesn't happen on Experience Builder 1.9.

I've tried changing the API version to 4.24 on Experience Builder 1.4, but, it didn't fix. So, I suppose that it's strictly related to the Experience Builder code.

I'm gonna mark this as solved. But, I welcome any workaround insight to make it work on 1.4.

Thanks,

Ualas

View solution in original post

0 Kudos
1 Reply
UalasRohrer
New Contributor III

I just notice that this issue doesn't happen on Experience Builder 1.9.

I've tried changing the API version to 4.24 on Experience Builder 1.4, but, it didn't fix. So, I suppose that it's strictly related to the Experience Builder code.

I'm gonna mark this as solved. But, I welcome any workaround insight to make it work on 1.4.

Thanks,

Ualas

0 Kudos