Hi John,
Thanks for contacting Syncfusion support.
We have analyzed your requirement and we suggest you to use the below way to achieve your requirement. You can bind actionBegin event and apply args.cancel as false to prevent the actions. Make AJAX request in actionBegin event and do your server side validation based on the AJAX success you may add the record programmatically by using addRecord method.
Please refer the code example for more information.
<ejs-grid #grid [dataSource]='data' [editSettings]='editSettings' [toolbar]='toolbar' (toolbarClick)='toolbarClick($event)' (actionBegin)="actionBegin($event)"
. . . . .
</ejs-grid>
actionBegin(args: any) {
if (args.action === 'add' && args.requestType === 'save') {
if(this.flag){ // If its from addRecord method then no need to cancel the action
args.cancel = true;
// make ajax request and do your server side validation
// in ajax success you can use the addRecord method (you can get edited data in args.data) to add the record in grid
}
}
}
function Success(data) {
. . . . .
this.grid.editModule.addRecord(args.data); //Add a record to Grid
this.flag = false; // default value true
popup.modal('hide');
}
|
Regards,
Hariharan