What is the difference here!!!????

I am puzzled with these results with a table component.

when i use


for (int i = 0; i < listOfTicketsVector.size(); i++)
			{				
				String employeeNo =listOfTicketsVector.get(i).getEmployeeNo();
				String firstName = listOfTicketsVector.get(i).getFirstName();
				String lastName = listOfTicketsVector.get(i).getLastName();
				String name = firstName + " " + lastName;
				String gender = listOfTicketsVector.get(i).getGender();
				String nationality = listOfTicketsVector.get(i).getNationality();
				String maritalStatus = listOfTicketsVector.get(i).getMaritalStatus();
				String position = listOfTicketsVector.get(i).getPosition();
				String employmentType = listOfTicketsVector.get(i).getEmploymentType();
				
				listOfEmployeesTable.addItem(new Object[] { employeeNo, name, gender, nationality, maritalStatus, position, employmentType}, new Integer(i));
			}
			listPanel.addComponent(listOfEmployeesTable);
 			setCompositionRoot(listPanel);	
		

The table shows the values

but when i use this code


for (int i = 0; i < employeeListVector.size(); i++)
			{
				Employee emp = new Employee();
				emp = employeeListVector.get(i);
				String employeeNo = emp.getEmployeeNo();
				String firstName = emp.getFirstName();
				String lastName = emp.getLastName();
				String name = firstName + " " + lastName;
				String gender = emp.getGender();
				String nationality = emp.getNationality();
				String maritalStatus = emp.getMaritalStatus();
				String position = emp.getPosition();
				String employmentType = emp.getEmploymentType();
				listOfEmployeesTable.addItem(new Object[] { employeeNo, name, gender, nationality, maritalStatus, position,employmentType },new Integer(i));
				
			}
			listPanel.addComponent(listOfEmployeesTable);
			setCompositionRoot(listPanel);	

the table shows no values.

So pliz what is the issue here…

I got my table working by the previous method so i wonder why the second should return nothing??

while the difference is only

Employee emp = new Employee();
				emp = employeeListVector.get(i);
				String employeeNo = emp.getEmployeeNo();

from this one

String employeeNo =listOfTicketsVector.get(i).getEmployeeNo();

I can’t see from the code where the problem might be. Could you try to isolate the problem further and perhaps write a small one-file example about it?

Why do you first create the object with New and then in the next line assign from a vector? This should not cause your problem though.

Are the table’s properties (=columns) set up correctly in both cases?

For example, this works:

        
        Table t = new Table();
        t.addContainerProperty("A string", String.class, null);
        t.addContainerProperty("A number", Double.class, null);
        getMainWindow().addComponent(t);
        for (int i = 0; i < 50; i++) {
            t.addItem(new Object[] { "String " + i, new Double(Math.random()) },
                    new Integer(i));
        }

while this
does not
work:

        
        Table t = new Table();
        getMainWindow().addComponent(t);
        for (int i = 0; i < 50; i++) {
            t.addItem(new Object[] { "String " + i, new Double(Math.random()) },
                    new Integer(i));
        }

Perhaps this is your problem? (The table and/or container that you are using is not shown in the code, so I can’t tell for sure…)

//Marc