Hi Toan,
Greetings from Syncfusion support.
Based on your requirement you want discard the changes while clicking another row while editing. You can achieve your requirement by using the recordClick , actionBegin event of the Grid and closeEdit method of the Grid. Please refer the below code example and sample for more information.
<ejs-grid #grid [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [editSettings]='editSettings'
(actionBegin)="actionBegin($event)" (recordClick)="recordClick($event)" [toolbar]='toolbar'>
<e-columns>
. . . </e-columns>
</ejs-grid> |
export class AppComponent {
public data: Object[];
@ViewChild('grid', {static: true})
public grid: GridComponent;
public clickRowIndex: number = -1;
. . .
actionBegin (args) {
if (args.requestType === 'save' && this.clickRowIndex !== args.rowIndex) {
// here if user clicked another row while editing we can cancel the save action and cancel the changes
args.cancel = true;
this.grid.closeEdit();
}
}
recordClick (args) {
this.clickRowIndex = args.rowIndex;
} |
Please let us know if you need further assistance.
Regards,
Manivel