ronaldmathies
30 Jun 2009, 11:05 AM
I'm having a small problem is that my combobox displays that there are rows but it doesn't show the text within the rows (so i have empty rows).
My code is as follow:
// Create a ListLoader
BaseListLoader<ListLoadResult<ProjectModelData>> projectListLoader =
new BaseListLoader<ListLoadResult<ProjectModelData>>(new ProjectRpcProxy());
// Force loading of the data
projectListLoader.load();
ComboBox<ProjectModelData> projectCombobox = new ComboBox<ProjectModelData>();
projectCombobox.setEmptyText("Select...");
projectCombobox.setDisplayField("description");
projectCombobox.setForceSelection(true);
projectCombobox.setStore(new ListStore<ProjectModelData>(projectListLoader));
The ProjectRpcProxy retrieves the data from the server and this works find, the store has the data after retrieving it form the server.
The ProjectModelData is as follow:
public class ProjectModelData extends BaseModelData {
private static final long serialVersionUID = 1L;
private CProject project = null;
public ProjectModelData(CProject project) {
this.project = project;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Object get(String property) {
if (property.equals("description")) {
return project.getDescription();
} else if (property.equals("history")) {
return project.isHistory();
}
return null;
}
/**
* Returns the project.
* @return the project.
*/
public CProject getProject() {
return this.project;
}
}
I have used this ProjectModelData already in a number of screens for grids and their it works fine.
When i now open the list i get this list with empty lines, if i select a value and see what is selected i can see it selected the correct value.
if i debug i can see that it retrieves the data from the model that needs to be displayed.
However, why doesn't iut actually show the data in the combo box.
Does anybody have a clue how to solve this?
My code is as follow:
// Create a ListLoader
BaseListLoader<ListLoadResult<ProjectModelData>> projectListLoader =
new BaseListLoader<ListLoadResult<ProjectModelData>>(new ProjectRpcProxy());
// Force loading of the data
projectListLoader.load();
ComboBox<ProjectModelData> projectCombobox = new ComboBox<ProjectModelData>();
projectCombobox.setEmptyText("Select...");
projectCombobox.setDisplayField("description");
projectCombobox.setForceSelection(true);
projectCombobox.setStore(new ListStore<ProjectModelData>(projectListLoader));
The ProjectRpcProxy retrieves the data from the server and this works find, the store has the data after retrieving it form the server.
The ProjectModelData is as follow:
public class ProjectModelData extends BaseModelData {
private static final long serialVersionUID = 1L;
private CProject project = null;
public ProjectModelData(CProject project) {
this.project = project;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Object get(String property) {
if (property.equals("description")) {
return project.getDescription();
} else if (property.equals("history")) {
return project.isHistory();
}
return null;
}
/**
* Returns the project.
* @return the project.
*/
public CProject getProject() {
return this.project;
}
}
I have used this ProjectModelData already in a number of screens for grids and their it works fine.
When i now open the list i get this list with empty lines, if i select a value and see what is selected i can see it selected the correct value.
if i debug i can see that it retrieves the data from the model that needs to be displayed.
However, why doesn't iut actually show the data in the combo box.
Does anybody have a clue how to solve this?