Select to view content in your preferred language

Filter Widget; possible to only allow one active filter at a time?

332
5
02-18-2025 08:09 AM
Labels (1)
MichaelMarlatt1
Occasional Contributor

Hello,

I've got a simple app with a filter widget with three different filters all looking at the same column of the same layer.  One filter displays just records with the top 10% (column > a set value), the next displays the top 25%, and the last displays the top 50%.  

When AND is selected in the Filter Widget's Content tab and I turn on more than one filter, it looks to the user like only the most restrictive filter is active.  That is, if the "top 10%" and the "top 50%" filters are both turned on, then it looks like only the "top 10%" filter is turned on.  Naturally, when OR is selected this behavior is reversed and the "top 50%" filter appears to be the only one working.  

I understand how ANDs and ORs work and why this is happening but I am concerned that the end users will get confused when they have more than one filter turned on but only one will appear to them to be working.

Is it possible to set up this widget so that when you turn on one filter it automatically turns off the other filters?  What I'm thinking of is like how "radio buttons" work; the filters will be mutually exclusive.

Alternatively, is there another widget that can act like a filter?  I've looked through the available widgets and nothing is jumping out at me as a candidate.  However, I am new to Experience Builder and I'd like to double check that I'm using this widget properly before I go and try to create a custom one.  

I'm using v1.16 (developer version).  

Thank you,

 

Mike

0 Kudos
5 Replies
abureaux
MVP Frequent Contributor

hahaha. I was tackling this just last Friday!

Short answer: "No".

Longer answer is that I found two ways to do this. Both are convoluted.

Method 1 (I opted for this option, for my latest project):

  1. Use the list Widget. You will need to upload a table of unique values (I'm not sure of a different way to do this). In my case, my table has 3 vales: Assessment, Redeveloped, and Remediated. These values need to match whatever column you want to filter. You can configure the widget to look like buttons and match your experience
    abureaux_0-1739904600557.png
  2. Use the Actions tab to "filter" the map
    abureaux_1-1739904651668.pngabureaux_2-1739904682816.png

    NOTE: I called my table "state" rather than "status" because I was rushing to try different things. But "State" is my uploaded table.

I actually really like this one. It will be a public website later this week as I am setting it up specifically for demo purposes. Unfortunately, you will need to wait a day or so for me to finish a few things. Here are screen caps though...

abureaux_3-1739904793397.png

abureaux_4-1739904801049.png

 

Method 2:

  1. Set up views of your data showing the different states.
  2. Create separate maps with all the different view (e.g., 5 views, 5 maps)
  3. Add duplicates Pages to your Experience, each with it's own map, and use the Data operations to link the maps. Basically, if you Zoom/Pan in one, all the other maps Zoom/Pan to match.
  4. Use buttons to swap between the pages.
JeffreyThompson2
MVP Frequent Contributor

Sounds like a column for the Tips and Tricks Board...

GIS Developer
City of Arlington, Texas
0 Kudos
abureaux
MVP Frequent Contributor

Good idea. I'm sure even future me will forget what I did, so a guide is a smart idea!

0 Kudos
JeffreyThompson2
MVP Frequent Contributor

I look up stuff from my own posts all the time.

GIS Developer
City of Arlington, Texas
0 Kudos
JeffreyThompson2
MVP Frequent Contributor

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#definiti...

Since you are on Developer Edition, a Custom Widget that has radio buttons and adds different definitionExpressions to the layer will probably be your best option.

GIS Developer
City of Arlington, Texas