Hi lorryl,
Greetings from Syncfusion support.
We checked your query and provided code. Based on that we would like to inform you that, by default in EJ2 Grid- actionBegin is the synchronous function, we cannot handle any asynchronous operation in the actionBegin event. So you cannot perform asynchronous operation in this event.
If you want to perform an asynchronous operation, we suggest you use the args.cancel as “true” initially based on the flag value.
Once you have checked the args.cancel then you can perform an asynchronous operation. Once you got success in an asynchronous operation we suggest you to call the “endEdit()” method of Grid. If you call endEdit method, you will receive the args.requestType as “Save”, now you can check the flag value and then set the args.cancel as true.
Code Example :
function actionBegin(args: any): void {
var flag;
if (args.requestType === 'save') {
if(flag){
args.cancel= true;
flag = false
}
// perform your asynchronous function here
//asynchronous function.onSuccess = function (result) {
// flag= true;
// this.grid.endEdit();
// }
}
} |
Please get back to us if you need further assistance.
Regards,
Praveenkumar G