View Full Version : EditableGrid>Inserting newly created rows>How to set ID of new record?

1 Jun 2007, 9:45 AM
Ok here's what we have

1. USER EDITS a column of editable grid
2. Update event fires and sends the JSON to the server
3. PHP loops thru the JSON records and finds one without an ID field set as null
4. PHP script does an INSERT on this row (rather than an UPDATE)

How do I set the value of the ID field in the Grid's dataStore with the newly inserted record's ID (primary key)

I assume I would need to return a JSON status response from the server and include the ID for the new record. Is this correct?

Does anyone have an example of how the javascript code would look like? I'm very new to EXT and javascript.

1 Jun 2007, 2:44 PM
Yes, one possibility is that new ID is returned by the server in response json and you process it in your code.

I have chosen to reload whole page of data from server.

Depending on you needs you can choose either method.