Reactive/Mobile Dropdown Tags: how to clear the selected items

I'm looking for a way to clear the selected items in the Dropdown Tags element.

Dropdown tags uses the Choices library (https://github.com/jshjohnson/Choices).

Using the standard Choices library (outside OutSystems), I managed to clear the choices field by either resetting the form, or calling .removeActiveItems() on the choices object in JavaScript.  You can find the CodePen with that attempt here

The first option: using a Form and a button with type="reset" doesn't clear the DropdownTags field in OutSystems.

The second option, calling .removeActiveItems() on the choices object, might work in OutSystems, if I would know how to reference the choices object given the Widget Id of the DropdownTags component.

Anyone have an idea how to do this?

Is there another way to do this?

Solution

Hi Steven,

On the button just do a ListClear on the variable that you use on the input SelectedItemsList. In this example would be SelectedDropdownItemList

Regards,

Marcelo

Solution

Hello Steven,


I think you can do this by passing an initial empty list to the dropdown tags widget, and then creating a button that clears this list. When it's cleared, it'll change, so it'll trigger the OnParametersChanged, which will try to serialise this new empty list and therefor clear your current tags. 


Attached an example .oml, hope it helps