How do I update a piece of data in an existing dataset? The following is the code I have for updating and adding to an existing dataset, the add works correctly, but how do I make the update work?
function
AddEntityToDataSource(entityset, entity) {
var
ds = GetDataSource(entityset);
ds.add(entity);
}
function
UpdateEntityToDataSource(entityset, entity) {
var
ds = GetDataSource(entityset);
entity = ds.get(entity.id);
}
5 Answers, 1 is accepted
0
Hi Jonathan,
Regards,
Rosen
the Telerik team
In order to modify field values of a Model instance you should use its set method:
entity = ds.get(entity.id);
entity.set(
"foo"
,
"bar"
);
// set foo field value to be bar
Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mitchell
Top achievements
Rank 1
answered on 23 May 2012, 11:46 AM
Thanks Rosen, nice piece of information.
-------------------
-------------------
0
Jonathan
Top achievements
Rank 1
answered on 23 May 2012, 03:47 PM
Is there a way I can replace the entire entity?
0
Hi Jonathan,
Rosen
the Telerik team
I'm afraid this is not supported.
All the best,Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
John
Top achievements
Rank 1
answered on 23 May 2012, 06:27 PM
Thanks