I'd like to perform an odata PATCH operation where only the dirty fields are sent in the request body.The code below is my latest attempt, but the grid continues to send the full set of fields. If I omit the data/type sections of the update option, then I get a PUT request with the full set of fields.
My other attempt involved omitting the update altogether and overriding the saveChanges event to make the request myself, but then I run into issues with dirty fields staying dirty. I know you can mess around with the css to remove the flags, but the datasource fields stay dirty and end up getting updated again the next time the saveChanges event is triggered.
Is there a way to let the grid know that the saveChanges event was successful so that it handles the dirty flags on its own? Another solution?
Thanks.
transport: {
read: {
url: serviceURL + entity.ClassName
},
update: {
url:
function
(data) {
var
key =
"("
+ data.ID +
","
+ data.NetworkID +
","
+ data.From +
","
+ data.To +
")"
;
return
serviceURL + entity.ClassName + key;
},
type:
"PATCH"
,
data:
function
(data) {
var
row = $(
"#elementGrid"
).data(
"kendoGrid"
).dataSource.get(data.ID);
var
updateData = {};
$.each(row.dirtyFields,
function
(key, value) {
updateData[key] = row[key];
});
return
updateData;
}
}
}