From 299d9ffa181b83b862b1262df014a28cfd680973 Mon Sep 17 00:00:00 2001 From: Youssef El Houti Date: Wed, 28 Aug 2019 02:11:26 +0200 Subject: [PATCH] add originalEvent to cellEdit events --- src/app/components/table/table.ts | 8 ++++---- src/app/showcase/components/table/tabledemo.html | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/components/table/table.ts b/src/app/components/table/table.ts index 25b45b96aa1..1bcec1a1f0f 100644 --- a/src/app/components/table/table.ts +++ b/src/app/components/table/table.ts @@ -1427,7 +1427,7 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable if (this.editingCell && !this.editingCellClick && this.isEditingCellValid()) { DomHandler.removeClass(this.editingCell, 'ui-editing-cell'); this.editingCell = null; - this.onEditComplete.emit({ field: this.editingCellField, data: this.editingCellData }); + this.onEditComplete.emit({ field: this.editingCellField, data: this.editingCellData, originalEvent: event }); this.editingCellField = null; this.editingCellData = null; this.unbindDocumentEditListener(); @@ -3098,7 +3098,7 @@ export class EditableColumn implements AfterViewInit { if (event.keyCode == 13) { if (this.dt.isEditingCellValid()) { this.closeEditingCell(); - this.dt.onEditComplete.emit({ field: this.field, data: this.data }); + this.dt.onEditComplete.emit({ field: this.field, data: this.data, originalEvent: event }); } event.preventDefault(); @@ -3108,7 +3108,7 @@ export class EditableColumn implements AfterViewInit { else if (event.keyCode == 27) { if (this.dt.isEditingCellValid()) { this.closeEditingCell(); - this.dt.onEditCancel.emit({ field: this.field, data: this.data }); + this.dt.onEditCancel.emit({ field: this.field, data: this.data, originalEvent: event }); } event.preventDefault(); @@ -3116,7 +3116,7 @@ export class EditableColumn implements AfterViewInit { //tab else if (event.keyCode == 9) { - this.dt.onEditComplete.emit({ field: this.field, data: this.data }); + this.dt.onEditComplete.emit({ field: this.field, data: this.data, originalEvent: event }); if (event.shiftKey) this.moveToPreviousCell(event); diff --git a/src/app/showcase/components/table/tabledemo.html b/src/app/showcase/components/table/tabledemo.html index 82d7fbe8636..f562edaea96 100644 --- a/src/app/showcase/components/table/tabledemo.html +++ b/src/app/showcase/components/table/tabledemo.html @@ -2663,14 +2663,14 @@

Events

onEditComplete event.column: Column object of the cell
event.data: Row data
- event.index: Row index + event.originalEvent: Browser event Callback to invoke when cell edit is completed. onEditCancel event.column: Column object of the cell
event.data: Row data
- event.index: Row index + event.originalEvent: Browser event Callback to invoke when cell edit is cancelled with escape key.