My program can add or update profiles. In the update profile dialog, after selecting which profile u want to update. Fields should fill with selected profile values. The problem starts with filling the CheckboxGroup field. (My CheckboxGroup field name is listBox so after that I'm gonna call it that way). when I check my listBox selected items I can see the listBox selected values are true but in the frontend, I can't see any selection. So basically I want to reselect lists in addValueChangeListener but CheckboxGroup not rerendering.
listBox = new CheckboxGroup<>();
listBox.setItemLabelGenerator(Lists::getListName);
listBox.setItems();
listBox.setItems(listsList);
listBox.addThemeVariants(CheckboxGroupVariant.LUMO_VERTICAL);
listBox.setHeight("200px");
listBox.getStyle().set("overflow","AUTO");
listBox.setHelperText("Seçilen Listeler");
listBox.addThemeVariants(CheckboxGroupVariant.LUMO_HELPER_ABOVE_FIELD);
updateProfile.addValueChangeListener(e -> {
setUpdateProfileValues();
});
}
private void setUpdateProfileValues() {
if (updateProfile.getValue() == null)
return;
updateProfileName.setValue(updateProfile.getValue().getProfileName());
simAlgorithm.setValue(updateProfile.getValue().getSimAlgorithm());
searchType.setValue(updateProfile.getValue().getSearchType());
operationType.setValue(updateProfile.getValue().getOperatorType());
simPercentage.setValue(updateProfile.getValue().getSimPercentage());
numberOfResult.setValue(updateProfile.getValue().getNumberOfResults());
List<Lists> selectedLists = updateProfile.getValue().getLists();
selectedLists.forEach(lists -> log.error(lists.getListName()));
//selectedLists.forEach(listBox::select);
listBox.setValue(new HashSet<>(selectedLists));
listBox.getSelectedItems().forEach(selectedList -> log.error(selectedList.getListName()));
}
Here is my related code piece for this question. BTW when I check the logs I can see listBox has true selected values. But I need to show on frontend page.