ModelData interface gxt
I'm implementing a server-client data transfering in gxt. So, I have a 开发者_Go百科Bean class and a class that extends BeanModelMarker. Then I fill my bean's fields with data from DB on server. Then I use GWT RPC
Should I use gxt beanmodelfactory to convert my beants to model data and to fill my grid? Where and when should I use it?
You will need to use it in the success call in your RPC event so (i am gonna assume your pojo is called Bean)
@Override
public void onSuccess(Bean pojo) {
BeanModelFactory factory = BeanModelLookup.get().getFactory(Bean.class);
BeanModel bean = factory.createModel(pojo);
}
You need to use the BeanModelReader in the loader:
BeanModelReader reader = new BeanModelReader();
ListLoader<ListLoadResult<ModelData>>loader = new BaseListLoader<ListLoadResult<ModelData>>(proxy,reader);
please check out the com.extjs.gxt.ui.client.data.BeanModelReader
- This should help you to get the Data into your grid.
Take a look at following example to see what Reader, Loader, Proxy and Store are doing:
http://www.sencha.com/examples/pages/grid/beanmodel.html
精彩评论