|
actionBegin(e)
if (!this.flag) {
if (e.requestType == 'save') {
var editedData = e.data;
// The default edit operation is cancelled
e.cancel = true;
// Here you can send the updated data to your server using ajax call
var ajax = new Ajax({
url: 'https://ej2services.syncfusion.com/production/web-services/',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify([editedData])
});
ajax.onSuccess = (args) => {
// Flag is enabled to skip this execution when grid ends add/edit
this.flag = true;
// The added/edited data will be saved in the Grid
this.grid.endEdit();
}
ajax.onFailure = (args) => {
// Save failed
// The flag is disabled if operation is failed so that it can enter the condition on next execution
this.grid.cancelEdit();
this.flag = false;
}
ajax.send();
}
}
} |