PDA

View Full Version : BeanModel Grid



aurelie
27 Jul 2009, 12:42 AM
Hi,

I wish to have a BeanModel Grid but when i launch the program, my grid is empty.
Here is my code :


DomaineServiceAsync domaineService = (DomaineServiceAsync)GWT.create(DomaineService.class);

configs = new ArrayList<ColumnConfig>();
column = new ColumnConfig();


//nom du domaine
column = new ColumnConfig();
column.setId("DOM_NOM");
column.setHeader(constants.domain_name());
column.setWidth(200);
configs.add(column);

//nom fran├žais du domaine
column = new ColumnConfig();
column.setId("nomFrancais");
column.setHeader(constants.domain_french_name());
column.setAlignment(HorizontalAlignment.RIGHT);
column.setWidth(200);
configs.add(column);

//description du domaine
column = new ColumnConfig();
column.setId("description");
column.setHeader(constants.domain_description());
column.setWidth(100);
configs.add(column);

// proxy and reader
RpcProxy<List<DomaineIndicateurBean>> proxy = new RpcProxy<List<DomaineIndicateurBean>>() {
@Override
public void load(Object loadConfig, AsyncCallback<List<DomaineIndicateurBean>> callback) {
domaineService.getListDomaines(callback);
}
};
BeanModelReader reader = new BeanModelReader();

// loader and store
ListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>(proxy, reader);
ListStore<BeanModel> store = new ListStore<BeanModel>(loader);

loader.load();

ColumnModel cm = new ColumnModel(configs);

grid = new Grid<BeanModel>(store, cm);
grid.setStyleAttribute("borderTop", "none");
panel.add(grid);
My function "getListDomaines" is good.
Can someone help me please?

Kalle1985
5 Aug 2009, 3:16 AM
Hi aurelie,

add this to your code. Maybe it helps...




grid.setLoadMask(true);
grid.addListener(Events.Attach, new Listener<GridEvent<BeanModel>>() {


@Override
public void handleEvent(GridEvent<BeanModel> be) {
grid.getStore().getLoader().load();
}


});


Also delete this sequence in your code: //loader.load();

aurelie
5 Aug 2009, 4:45 AM
I have found the problem.
Thank you

anton_ds
5 Aug 2009, 8:57 PM
I have found the problem.
Thank you
What was this problem ?? :))

now i have same problem (http://extjs.com/forum/showthread.php?p=369362#post369362) as u.. can u help me ??

aurelie
5 Aug 2009, 11:04 PM
read the subject : GXT 2.0 BeanModel objects always null (http://extjs.com/forum/showthread.php?t=74220)
the date is 08-03-2009.
it may help you if you're using gilead