Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Select component doesn't show the selected value when the form is edited
Hai all,
I have a problem with Select component.
I have a form with Select component, When I store the data into DataBase the component is working fine. But When I edit the record from the table the from doesn't show the selected value in Select component, but remaing all components are working fine. Please give the solution.
thanks in advance.
Could you explain in more detail what are you trying to do and/or show some code. I didn't quite understand, what is the problem.
hai Johannes, thanks for reply.
Actually I have table, when I select any row in the table and click edit button it display a subwindow with selected row values in the table. Here all the textfileds values are displayed the in the subwindow, but the values in the dropdown list(Select or combobox) are doesnt display the previous selected values.......but the list of values are there inside dropdown list.............please give the solution...................thanks in advance....................
What is the type of items in the ComboBoxes (what container type?). What is the Property value type of for example the property "Portal Institution"?
hai Johannes ,
I am using a BeanItemContainer and here portalInstituion is an entity.
this is my entity....
------------------
@Entity
public class PortalUser implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private PortalInstitution portalInstitution;
..................................
}
this is my controller class
----------------------------------
BeanItemContainer<PortalUser> portalUser=new BeanItemContainer<PortalUser>(PortalUser.class);
portalUser.addAll(usersList);
userTable=new Table(null,portalUser);
When I press the edit button the following code will be executed....................
panel.getApplication().getMainWindow().addWindow(
new PortalUserEditor((BeanItem<PortalUser>) userTable.getItem(userTable.getValue()));
this is in my editor class
----------------------------------
public Field createField(Item item, Object propertyId, Component uiContext) {
String pid=(String)propertyId;
try{
if(pid.equals("portalInstitution")){
System.out.println("....in inst.....");
List<PortalInstitution> institutions=(List<PortalInstitution>) portalInstGenHome.getActiveInstitution();
institutionsSelect.setWidth("200px");
institutionsSelect.removeAllItems();
if (institutions != null && institutions.size() > 0) {
for (PortalInstitution institution : institutions) {
institutionsSelect.addItem(institution);
institutionsSelect.setItemCaption(institution, institution.getInstName());
}
}
return institutionSelect;
}
please give a solution.......................thanks.......................
Did you resolve this already? I guess none of the instances of PortalInstitution from portalInstGenHome.getActiveInstitution() equal to PortalUser.portalInstitution. When setting the current selection of Select the container.containsId is called and that eventually calls List.contains which compares id objects with equals.