开发者

How to work with GXT Grid?

I have a DTO object with fields:

public class EmpDTO extends BaseModel implements java.io.Serializable {
    private short empno;
    private EmpDTO emp;
    private DeptDTO dept;
    private String ename;
    private String job;

I try output this class in the grid:

List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig clmncnfgEname = new ColumnConfig("ename", "ename", 150);
configs.add(clmncnfgEname);
ListStore<Em开发者_如何学运维pDTO> store = new ListStore<EmpDTO>();
EmpDTO empDTOtmp = new EmpDTO();
empDTOtmp.setEname("Name");
store.add(empDTOtmp);
Grid<EmpDTO> grid = new Grid<EmpDTO>(store, new ColumnModel(configs));
mainContentPanel.add(grid);

But i see empty grid with out error. How to fix this?


Do you have to use BaseModel? Rather than extending BaseModel why not implement BeanModelTag?

public class EmpDTO implements BeanModelTag {

Otherwise make sure setEname looks like this:

public void setEname(String ename) {
  set("ename",ename);
}

And getEname looks like this:

public String getEname() {
   return (String)get("ename");
}


Go through this link ... I think you might be missing out on some key steps to setup a grid. http://zawoad.blogspot.com/2009/08/how-to-create-simple-grid-using-gxtext.html

It shows through simple steps on how to create a GXT based grid and helped me out a lot. Also personally I have had this issue on some occasions. Make sure your DTO fields have been correctly mapped to the Grid column config. This might be the problem.

I would recommend you to go through the above post and cross check your grid implementation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜