PDA

View Full Version : Question about appropriate use of Store



benju
5 May 2009, 1:07 PM
I have a question about the appropriate way to use stores in GTX 2.0. Currently I have a store of BeanModels bound to a grid. The purpose of this grid is to list/add/edit/delete financial transactions from a server side database.

The stores seem to work great, when I programatically update a BeanModel it seems to instantly update my grid. I have a popup form which is triggered on double click of the row, this popup uses formbinding to edit the beanmodel.

The question in my mind now is how should I take changes made to my beanmodels and store them in the database. I have read the entire new book on Ext-GWT http://www.apress.com/book/view/9781430219408 from Apress (it came out yesterday) and in its examples it seems to first persist things to the database via XML-RPC (I understand how to do this) and on success add it to the store which in turn adds it to the grid.

Option 1-

What I am thinking would be cool is to use store listeners to know when to add/edit/delete my database via XML rpc.

Is this an apropraite use of the Store Listener? I wonder if the store listener was more meant for UI components to be notified that they should update or if it can work in the way I am proposing.

Option 2-

Handle adding things to the store and adding things to the DB via RPC seperately in each spot I can possibly be updating things.

Any feedback?
Thanks