PDA

View Full Version : store.load / store.save ?



valery.stroeder
17 Dec 2009, 3:16 AM
Hello,

Here is my process to put datas from database in the grid when it's displayed :



protected ListLoader getLoader() {
BeanModelReader reader;
RpcProxy proxy;

myServiceAsync = Registry.get("myServiceAsync");
proxy = new RpcProxy<List<MyPOJO>>() {
@Override
public void load(final Object loadConfig, final AsyncCallback<List<FoodType>> callback) {
myServiceAsync.getAllMyPOJO(callback);
}
};

reader = new BeanModelReader();
loader = new BaseListLoader(proxy, reader);
return loader;
}

...
store = new ListStore<BeanModel>(loader)();
Grid<BeanModel> myGrid = new Grid<BeanModel>(store, cm);
...
myGrid.addListener(Events.Attach, new Listener<BaseEvent>() {
public void handleEvent(final BaseEvent be) {
store.getLoader().load();
}
});
All is ok to load my datas from database and display it in the grid thus translation POJO -> beanModel is automatic.

Now I would like save the modified values without make the translation BeanModel -> POJO by myself.

Doesn't a sort of "store.save()" exist ? What's the best way to save my store's datas ?

Thanks