PDA

View Full Version : Empty Gxt Grid!



dbibi.ahmed
13 Apr 2011, 6:52 AM
Hi,
i'm developing an application with a grid that shows a model.
So,
- i have created my ColumnConfig objects,
- i have created the ColumnConfig list (adding it the ColumnConfig objects),
- i have created the object ListStore, and
- i have added it the list of models that i want to show in the grid (from RPC result).
Then i have created a ColumnModel object, so i have created the grid with ColumnModel and ListStore.
But when i execute my app, the grid appears, the rows of my models also appear, but these rows are empty.
I am not understanding why it happens.
Some help please,



ListStore<Utilisateur> L = new ListStore<Utilisateur>();
Grid<Utilisateur> grid;

utilService.getUtilisateur(new AsyncCallback<List<Utilisateur>>() {
public void onFailure(Throwable caught) {
System.out.println("Failed to load users.");
}
@Override
public void onSuccess(List<Utilisateur> result) {

L.add(result);
grid = new Grid<Utilisateur>(L, new ColumnModel(configs));

grid.setAutoHeight(true);
grid.setBorders(true);
grid.setStripeRows(true);

}
});




public class Utilisateur extends BaseModel implements java.io.Serializable { /**
*
*/
private static final long serialVersionUID = 1L;

private String idUtilisateur;
private Integer idHearchi;
private Integer attribute1;
private String pwd;
private String nomUtilisateur;
private String prenomUtilisateur;
private Integer privilege;
private String fonction;

public Utilisateur() {
}

public Utilisateur(String idUtilisateur, Integer idHearchi, Integer attribute1, String pwd, String nomUtilisateur, String prenomUtilisateur, Integer privilege, String fonction) {
this.idUtilisateur = idUtilisateur;
this.idHearchi = idHearchi;
this.attribute1 = attribute1;
this.pwd = pwd;
this.nomUtilisateur = nomUtilisateur;
this.prenomUtilisateur = prenomUtilisateur;
this.privilege = privilege;
this.fonction = fonction;
}

public String getIdUtilisateur() {
return this.idUtilisateur;
}

public void setIdUtilisateur(String idUtilisateur) {
this.idUtilisateur = idUtilisateur;
}
public Integer getIdHearchi() {
return this.idHearchi;
}

public void setIdHearchi(Integer idHearchi) {
this.idHearchi = idHearchi;
}
public Integer getAttribute1() {
return this.attribute1;
}

public void setAttribute1(Integer attribute1) {
this.attribute1 = attribute1;
}
public String getPwd() {
return this.pwd;
}

public void setPwd(String pwd) {
this.pwd = pwd;
}
public String getNomUtilisateur() {
return this.nomUtilisateur;
}

public void setNomUtilisateur(String nomUtilisateur) {
this.nomUtilisateur = nomUtilisateur;
}
public String getPrenomUtilisateur() {
return this.prenomUtilisateur;
}

public void setPrenomUtilisateur(String prenomUtilisateur) {
this.prenomUtilisateur = prenomUtilisateur;
}
public Integer getPrivilege() {
return this.privilege;
}

public void setPrivilege(Integer privilege) {
this.privilege = privilege;
}
public String getFonction() {
return this.fonction;
}

public void setFonction(String fonction) {
this.fonction = fonction;
}
}

blay
15 Apr 2011, 6:58 AM
The BaseModelData uses a map and no "regular attributes". So your getters and setters should be like:

public Type getAttributeA(){
return get("attributeA");
}

public void setAttributeA(Type attributeA){
set("attributeA",attributeA);
}

In the columConfig you should set the "id" attribute of each column with the name of the "attributes" you store in the map