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
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:
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