Programatically select all items in a Multiselect listbox?

Hi,

I'm using a Multiselect listbox and would like to programatically select all items in the listbox when an event is raised in another component.

I've read the docs and couldn't see any obviou way of doing this Multiselect | Retool Component Library

I tried something like below, but that didn't work

multiselectListboxActivities.data.forEach(d => {
  multiselectListboxActivities.setValue(d);
});

Any help appreciated.

A Multiselect listbox takes an array so you would pass something like this:

multiselectListbox1.setValue(['Option 1', 'Option 2'])

To select all items:

multiselectListbox1.setValue(formatDataAsObject(multiselectListbox1.data).value)

1 Like