This is a migrated thread and some comments may be shown as answers.

Insert newly created record with rowId from db

1 Answer 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gaetano
Top achievements
Rank 1
Gaetano asked on 03 Oct 2013, 03:51 PM
Hi, 
I'm building a grid bound to a remote source.
I Have Read and Create methods now.
When I create a new record everythings works fine, for the first "insert"
If I create another record the grid sends to the server both my new records.

I suppose that is because the key value of the model ( a simple ID -> rowId from db) is always 0 and so the datasource thinks that is a newly inserted record.
Is there a way to update my datasource with the rowId (that I manage to return back to client after being inserted on db)?
Or should I simply reload the grid (not so performing though)? 

I'm using inline & batch edit! 

Thanks
Fabio

1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 07 Oct 2013, 08:51 AM
Hi Fabio,

Your assumption is correct. Records with no ID are considered as newly created by the DataSource. In response to the create Ajax request, the server should return the updated record together with its ID (generated on the server).

The same issue is discussed in this forum topic. Please note that the server should return the whole newly inserted item (as an array) back to the client.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Gaetano
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or