Kendo UI Grid: handle error on update row

Monday, May 12, 2014

I have Angularjs and a Kendo grid bound to local data with the capability of inline editing. When i click on the update button i handle the "change" event that make a post request: if it fails i want cancel the update. I have this code:



$scope.profiliTesseraSlot = new kendo.data.DataSource({
data: obj,
schema: {
model: {
id: "TipoProdottoId",
fields: {
TipoProdottoId: { editable: false, type: "number" },
TipoProdottoNome: { editable: false },
Slot1: { type: "number" },
Slot2: { type: "number" },
Slot3: { type: "number" },
Slot4: { type: "number" },
Slot5: { type: "number" },
Slot6: { type: "number" },
}
}
},
change: function (e) {
if (e.action == "itemchange") {
$http.post("api/PrezzoTipoProdotto/PostPrezzoTipoProdotto", e.items)
.success(function (data) { })
.error(function (data) {
this.cancelChanges();
});
}
}
});


When is executed



this.cancelChanges();



why the grid doesn't cancel the update? I see on the row the updated value







http://ift.tt/1nEsNp6