Hi Team,
In an ej2-syncfusion grid I am using batch mode, On tabbing on last row last column a new row is getting added how to restrict adding row on tab. I am using the below code snippet.
Html file:
Ts file:
While using this code its not working and giving some error like event is deprecated.
Can you please provide me a solution for this issue.
Thanks,
Lahari Navudu
|
@Component({
selector: 'app-root',
template: `<ejs-grid #grid id="Batchgrid" [dataSource]="data" allowPaging="true" [editSettings]="editSettings"
(beforeBatchAdd)="beforeBatchAdd($event)" (cellEdit)="cellEdit($event)" [toolbar]="toolbar">
. . .
</ejs-grid>`
})
export class AppComponent {
. . .
beforeBatchAdd(args) {
if (this.flag == true) {
args.cancel = true;
this.flag = false;
}
}
cellEdit(args) {
let batchChanges: any = this.grid.getBatchChanges();
// based on the last row and column
if (parseInt(args.row.getAttribute('aria-rowindex')) == this.grid.currentViewData.length + batchChanges.addedRecords.length
- batchChanges.deletedRecords.length - 1 && args.columnName == 'ShipCountry' )
this.flag = true;
}
}
|