Skip to content

Commit

Permalink
Merge pull request #8092 from yelhouti/fix-8091 fixed #8111 add origi…
Browse files Browse the repository at this point in the history
…nalEvent to cellEdit events
  • Loading branch information
yigitfindikli authored Sep 2, 2019
2 parents 73b0fd3 + 299d9ff commit 51b4032
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -3108,15 +3108,15 @@ 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();
}

//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);
Expand Down
4 changes: 2 additions & 2 deletions src/app/showcase/components/table/tabledemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2663,14 +2663,14 @@ <h3>Events</h3>
<td>onEditComplete</td>
<td>event.column: Column object of the cell<br>
event.data: Row data <br />
event.index: Row index</td>
event.originalEvent: Browser event</td>
<td>Callback to invoke when cell edit is completed.</td>
</tr>
<tr>
<td>onEditCancel</td>
<td>event.column: Column object of the cell<br>
event.data: Row data <br />
event.index: Row index</td>
event.originalEvent: Browser event</td>
<td>Callback to invoke when cell edit is cancelled with escape key.</td>
</tr>
<tr>
Expand Down

0 comments on commit 51b4032

Please sign in to comment.