'How to filter multiple layers by same attribute in ArcGis with JavaScript

I need to filter features by one specific attribute which is same for every layer that I am using. I tried this tutorial https://developers.arcgis.com/javascript/latest/sample-code/featurefilter-attributes/ which workrs fine but just for one layer. How can I modify this code to add another layers? I want to filter on client side. My code is the same as in tutorial



Solution 1:[1]

You will need to apply the filter to each layer view, there is no general filter on the map.

I should not be much effort though, just iterate over the layers on the map, an in case of FeatureLayer apply filter to the FeatureLayerView.

ArcGIS API JS - Map

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 cabesuon