Select to view content in your preferred language

Reset segmented-control map component

60
2
yesterday
MillerDerek
Emerging Contributor

How are segmented control components reset? Setting the value = null or '' effectively clears the selection, but whatever value was previously set is not 'selectable' again until an alternate value is selected.

Here's a pen reproducing the issue - https://codepen.io/derekwmiller/pen/bNdxKEm

Select a value -> click the reset icon / button -> try to select the same value -> cannot select it

0 Kudos
2 Replies
KellyHutchins
Esri Frequent Contributor

The calcite doc for Segmented Control notes that it has functionality similar to a Radio Button. If you take a look at the Radio Button doc it notes that for interactions where a choice is optional consider a Checkbox. The key difference between a checkbox and radio button is that radios must always have something active. 

 

So perhaps look at using checkboxes for your scenario? 

0 Kudos
MillerDerek
Emerging Contributor

Thanks for the info @KellyHutchins. That makes sense. Checkboxes are less than ideal in this scenario -- image below.

I put together a work-around with a disabled & hidden calcite-segmented-control-item. The value of the segmented control is set to the hidden item on reset.

Updated pen - https://codepen.io/derekwmiller/pen/bNdxKEm

date-filters-screenshot.png

0 Kudos