View Full Version : Row Editor Grid - return database generated id after saving

5 Aug 2009, 12:47 AM

sry but i'm still a little bit e newbie, so here's my question.
I'm using a row editor grid. When i save a row, extjs generates an ID and sends it to the server. There the data is inserted in an Oracle Database and an ID is generated. After this, i return a Success Message. Now i thought about using this Success Message, returning the extjs generated ID and the Database generated ID and than updating the corresponding row with the Database generated ID. Otherwise i get into big troubles if someone adds and later updates the same row.

Is there any better solution or am i on the correct way?

Greets and Thx

5 Aug 2009, 4:11 AM
As far as i can tell there is no better way. Ext can never determine what ID will be generated by your database, so you will need to tell it somehow.
In fact, Ext.data.DataWriter (http://extjs.com/deploy/ext-3.0.0/docs/?class=Ext.data.DataWriter) abstracted part of this away for you.
Note that if using the datawriter you are expected to return the whole record from the server, just a success message and id won't suffice.