PDA

View Full Version : Working with a form bound to a data grid



gskluzacek
10 Nov 2010, 9:00 PM
Quick question on working with a form bound to a data grid:

The grid loads from a data store, you click on a record the form is populated.

My question is this, the user updates the data on the form by changing an existing record, inserting a new record or deleting an existing record, how should the process work when the user clicks the submit button on the form?

A) The on click event handler does a post of the form data to the database, then updates the data grid?

or

B) The on click event handler updates the data grid and the data grid posts the changes back to the database?

Right now I'm almost done coding it the first way, but I'm starting to question this approach. Something about it doesn't feel quite right.

But with the second approach I have no clue on how to get the data grid to post the changes back to the database, I only know how to populated the grid with a data reader, but not update the database with a data writer... is it even possible? How would the grid know which CRUD operation needs to be done for each changed record?

Just need someone to point me in the right direction. While not a complete noob I still learning the proper ExtJS techniques and approaches so some help would be much appreciated.

Thanks in advance.
-- Greg