PDA

View Full Version : Problem with BeanModelGrid



anton_ds
5 Aug 2009, 7:40 PM
I'm trying the example (http://extjs.com/examples/#beanmodelgrid), but grid is empty after loading.

I'm doing the same like in example (http://extjs.com/examples/#beanmodelgrid), except code about getting GWT RPC service.
I have it in a same module so i'm just use it.
Code:


private final GreetingServiceAsync greetingService = GWT
.create(GreetingService.class);
....................................
private void DrawEmpWindow() {
....................................
RpcProxy<List<Employee>> proxy = new RpcProxy<List<Employee>>() {
@Override
public void load(Object loadConfig,
AsyncCallback<List<Employee>> callback) {
System.out.println(greetingService.toString());
greetingService.getEmployees(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();

// column model
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(new ColumnConfig("id", "id", 50));
columns.add(new ColumnConfig("first_name", "first_name", 100));
columns.add(new ColumnConfig("last_name", "last_name", 100));
columns.add(new ColumnConfig("middle_name", "middle_name", 100));
columns.add(new ColumnConfig("email", "email", 50));
ColumnModel cm = new ColumnModel(columns);

Grid<BeanModel> grid = new Grid<BeanModel>(store, cm);




I'm using firebug, and i can see a data from greetingService.getEmployees(), but grid still doesn't render any data.
Can anyone help me?

anton_ds
5 Aug 2009, 8:55 PM
I already tryed to replace my

loader.load();

on



final Grid<BeanModel> grid = new Grid<BeanModel>(store, cm);
grid.setAutoExpandColumn("first_name");

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

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

});


Now it's always loading...