PDA

View Full Version : EditorGrid, data Store, Record: how to best use them?



raphinou
25 Apr 2007, 4:09 AM
Hi,

I have a web page with a form to add a record in a database table, and on the same page a EditorGrid displaying the existing records. How do I best use the EditorGrid, data store, Record and their related events to fully exploit Ext?

I thought of this, but I'm not sure it is correct.
Adding a new record:
First way: Submit the form the the server, which inserts the record in the DB, and then reload the data store of the Grid.

Alternative way: do not send the form to the server, but add the record to the datastore, and add an event handler for the "add" event which sends the record to the database. That way all communication with the backend is through the datastore.
Editing a record
First way: write an "afteredit" handler sending the data to the backend.

alternative way: use the datastore's "update" event to write a handler sending the data to the backend. again, all communication is through the datastore.

Is the alternative way a good solution, or is there a better way? I browsed the forum but didn't find a clear indication as to which approach is advised.

thanks for your help