Closed Shotty1984 closed 12 months ago
Try returning a Set
instead of an ArrayList
.
Try returning a
Set
instead of anArrayList
.
I figured out a little bit with vaadin and your CRUD UI, thanks for the cool addon, but I have a little problem, maybe I'm doing something wrong again, I need to display the current groups that I pass to multiSelectComboBox.select(currentGroups.subList(0, 3)); but this not work for me :( current groups not show in text line component MultiSelectComboBox.
Current groups but not yet selected:
My Example:
crud.getCrudFormFactory().setFieldProvider("availableGroups", o -> {
MultiSelectComboBox<GroupEntity> multiSelectComboBox = new MultiSelectComboBox<>();
List<GroupEntity> currentGroups = groupService.findAllByIdDomainAndService(idDomain, service);
multiSelectComboBox.setLabel("Select group");
multiSelectComboBox.setItems(currentGroups);
multiSelectComboBox.select(currentGroups.subList(0, 3));
multiSelectComboBox.setItemLabelGenerator(GroupEntity::getName);
return multiSelectComboBox;
});
When re-editing element it is necessary, that the groups have already been preselected, It should turn out like this:
If follow the documentation V23 (https://vaadin.com/docs/latest/components/multi-select-combo-box#Selection), this should work, but I it doesn't work :( please help me solve the problem.
Are you able to provide a minimal runnable project so I can reproduce the issue?
Closing this. If you still have the issue, please comment and provide more information and details.
I think me need help, I'm trying to use MultiSelectListBox component in CRUD UI, but I get an error when return multiSelectListBox through FieldProvider.
my test example:
after return multiSelectListBox:
java.lang.RuntimeException: com.vaadin.flow.data.binder.BindingException: An exception has been thrown inside binding logic for the field element [style='width:100%', multiple='true', readonly='true']
Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.Set (java.lang.String and java.util.Set are in module java.base of loader 'bootstrap')
When use simple ComboBox work ok, but me needed multiselect combobox :(, What am I doing wrong?