How to modify "multiSelectComboBox" to have checkbox that allow users to tick all value, not by choosing every single value

It’s inconvenient when using multiSelectCombobox that you have to pick too many value. How can I modify multiSelectComboBox and let users one tick can choose all value (multiselectcomboboxpicker can only applied for entity, not enums)
What I expect is in the below picture
image

Hello @anhnct.work ,

Jmix and Vaadin do not have this feature.

Regards,
Nikita

How can I reach to the solution if I have such as 1000 enum values. I have to tick 1000 times.
Thanks

You can implement two options. You can create a MultiSelectComboBox and add a button that selects all items, or a MultiSelectComboBoxPicker with a custom action.

MultiSelectComboBox:

image

XML:

            <hbox alignItems="END">
                <multiSelectComboBox id="multiField"
                                     label="msg://multiCombobox"
                                     width="100%"
                                     itemsEnum="com.company.jmixconstrunuqmssql.entity.TestEnum"/>
                <button id="selectAll" icon="vaadin:check-square-o"/>
            </hbox>

Controller:

    @Subscribe(id = "selectAll", subject = "clickListener")
    public void onSelectAllClick(final ClickEvent<JmixButton> event) {
        multiField.select(Arrays.stream(TestEnum.values()).toList());
    }

MultiSelectComboBoxPicker:

XML:

    <multiSelectComboBoxPicker id="multiPicker"
                               label="msg://multiPicker"
                               itemsEnum="com.company.jmixconstrunuqmssql.entity.TestEnum">
        <actions>
            <action id="allSelectAction" icon="vaadin:check-square-o"/>
        </actions>
    </multiSelectComboBoxPicker>

Controller:

    @Subscribe("multiPicker.allSelectAction")
    public void onMultiPickerAllSelectAction(final ActionPerformedEvent event) {
        multiPicker.select(Arrays.stream(TestEnum.values()).toList());
    }

Regards.
Nikita

1 Like