|
keyPressed(e) {
if (e.key === 'Enter') {
e.cancel = true; // prevent the default behavior of enter key with Grid
if (this.grid.isEdit) {
this.grid.saveCell();
}
if ((e.target as HTMLElement).classList.contains('e-rowcell')) {
const rIndex = Number((e.target as HTMLElement).getAttribute("Index"));
const cIndex = Number((e.target as HTMLElement).getAttribute("aria-colindex"));
const i = { rowIndex: rIndex, cellIndex: cIndex };
const field: string = this.grid.getColumns()[cIndex].field;
this.grid.editCell((rIndex), field);
}
}
if (e.key === 'Escape') {
this.grid.closeEdit();
}
}
|