Knitter
8 Mar 2011, 12:01 PM
Hi,
I'm having some trouble creating a grid with data loaded using RPC. The various column headers show, Firebug tells me that the data was loaded correctly but the grid has no rows and after I request a load the store is empty.
I'm trying to load objects of type Cliente, all my model classes are marked using the BeanModelMarker interface. I don't know if there is anything else I need to do to connect my model class to it's marker beyond the annotation.
This is the code I'm using to create the grid, the Conteudo class extends Composite:
public final class PainelClientes extends Conteudo {
private LayoutContainer root;
public PainelClientes() {
super();
init();
}
@Override
public void onRender(Element target, int index) {
super.onRender(target, index);
ArrayList<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(new ColumnConfig("codigo", "Código", 50));
columns.add(new ColumnConfig("nome", "Nome", 200));
columns.add(new ColumnConfig("email", "E-mail", 200));
//TODO: endereços, contactos e veículos
RpcProxy<ArrayList<Cliente>> proxy = new RpcProxy<ArrayList<Cliente>>() {
@Override
protected void load(Object loadConfig, AsyncCallback<ArrayList<Cliente>> callback) {
JAutoInvoiceApp.getInstance().getSrvCliente().listarTodos(callback);
}
};
BeanModelReader bmReader = new BeanModelReader();
BaseListLoader<ListLoadResult<BeanModel>> loader = new BaseListLoader<ListLoadResult<BeanModel>>(proxy, bmReader);
ListStore<BeanModel> store = new ListStore<BeanModel>(loader);
Grid<BeanModel> grelha = new Grid<BeanModel>(store, new ColumnModel(columns));
loader.load();
root.add(grelha);
}
@Override
public void init() {
root = new LayoutContainer(new BorderLayout());
initComponent(root);
}
@Override
public LayoutContainer getContainer() {
return root;
}
}
Any thoughts? I can't seem to find out what I'm missing.
Regards,
Knitter
I'm having some trouble creating a grid with data loaded using RPC. The various column headers show, Firebug tells me that the data was loaded correctly but the grid has no rows and after I request a load the store is empty.
I'm trying to load objects of type Cliente, all my model classes are marked using the BeanModelMarker interface. I don't know if there is anything else I need to do to connect my model class to it's marker beyond the annotation.
This is the code I'm using to create the grid, the Conteudo class extends Composite:
public final class PainelClientes extends Conteudo {
private LayoutContainer root;
public PainelClientes() {
super();
init();
}
@Override
public void onRender(Element target, int index) {
super.onRender(target, index);
ArrayList<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(new ColumnConfig("codigo", "Código", 50));
columns.add(new ColumnConfig("nome", "Nome", 200));
columns.add(new ColumnConfig("email", "E-mail", 200));
//TODO: endereços, contactos e veículos
RpcProxy<ArrayList<Cliente>> proxy = new RpcProxy<ArrayList<Cliente>>() {
@Override
protected void load(Object loadConfig, AsyncCallback<ArrayList<Cliente>> callback) {
JAutoInvoiceApp.getInstance().getSrvCliente().listarTodos(callback);
}
};
BeanModelReader bmReader = new BeanModelReader();
BaseListLoader<ListLoadResult<BeanModel>> loader = new BaseListLoader<ListLoadResult<BeanModel>>(proxy, bmReader);
ListStore<BeanModel> store = new ListStore<BeanModel>(loader);
Grid<BeanModel> grelha = new Grid<BeanModel>(store, new ColumnModel(columns));
loader.load();
root.add(grelha);
}
@Override
public void init() {
root = new LayoutContainer(new BorderLayout());
initComponent(root);
}
@Override
public LayoutContainer getContainer() {
return root;
}
}
Any thoughts? I can't seem to find out what I'm missing.
Regards,
Knitter