PDA

View Full Version : Editing a gird with a simple way



jonathan.scher
9 Sep 2009, 6:53 AM
Hello,

I'm a totaly noob in GWT and EXT, so my code is getting a little messy. Could you help me to simplify it ?

Basically I'd like it to :
- Ask a server for a list of "MyUser".
- Show them in an EditorGird, with a "commit" button.
- Whenever a user change a value, notify the server of which rows has to be updated.

Here is how I do it, and the associated problems...

The EditorGird is instanciated with a store, which is of type ListStore<MyUser>. This store is itself instanciated with an RPCProxy. In that proxy, I've overriden the method load to call my server throught Registry.get("MyServlet").
The gird has a bottom PagingToolBar, which has a "commit" button.

My first problem is that the gird shows up empty. I have to click on the "refresh" button to get my datas. What is the action behind this "refresh" thing? Could I call it inside the onRender function ?

Now things are going to be a little bit more messy.
I'd prefer not to add a "commit" button. So I've added a listener on my store, that catch the "Store.Update" event. Whenever someone click on it, I call store.commitChanges(). And here I've added a call to my server, notifying which row has been updated. But this event is raised twice ! As if store.commitChanges() is raising the same event a second time...
Is it possible to catch the "commit" event instead of the update one ? Is there any better way to achive my goals ?

Regards,
Jonathan