Hi, i want to create ComboBox that contain ‘code’ from Department Database,
this is the preload code for combobox
private void populateDepartment(){
cbSearchDepartment.clear();
try {
listDepartment = departmentService.getDepartmentListForComboBox(false);
System.out.println(listDepartment.size());
for (Department department : listDepartment) {
cbSearchDepartment.setItems(department.getCode());
}
if (listDepartment.size() > 0)
cbSearchDepartment.setValue(listDepartment.get(0).getCode());
}catch(Exception ex) {
ex.printStackTrace();
}
}
i test it with print size() of the listDepartment and it return the correct value, but the ComboBox is only show the last one of the database data, (‘ALL’ at the combobox can be set from the set value. see the image at the attachment)
thank you!
EDIT : i tried this method at Vaadin 8 and i dont have this issue at all