raise keyboard events, improve task list keyboard handling (#2401)

This commit is contained in:
Denys Vuika
2017-09-29 13:34:16 -04:00
committed by Eugenio Romano
parent 9f0e40a6e8
commit e756db03cd
5 changed files with 53 additions and 14 deletions

View File

@@ -8,7 +8,8 @@
[selectionMode]="selectionMode"
(row-select)="onRowSelect($event)"
(row-unselect)="onRowUnselect($event)"
(rowClick)="onRowClick($event)">
(rowClick)="onRowClick($event)"
(row-keyup)="onRowKeyUp($event)">
<loading-content-template>
<ng-template>
<!--Add your custom loading template here-->

View File

@@ -270,12 +270,7 @@ export class TaskListComponent implements OnChanges, OnInit, AfterContentInit {
(this.data && this.data.getRows() && this.data.getRows().length === 0);
}
/**
* Emit the event rowClick passing the current task id when the row is clicked
* @param event
*/
onRowClick(event: DataRowEvent) {
const item = event;
onRowClick(item: DataRowEvent) {
this.currentInstanceId = item.value.getValue('id');
this.rowClick.emit(this.currentInstanceId);
}
@@ -290,6 +285,14 @@ export class TaskListComponent implements OnChanges, OnInit, AfterContentInit {
this.rowsSelected.emit(this.selectedInstances);
}
onRowKeyUp(event: CustomEvent) {
if (event.detail.keyboardEvent.key === 'Enter') {
event.preventDefault();
this.currentInstanceId = event.detail.row.getValue('id');
this.rowClick.emit(this.currentInstanceId);
}
}
/**
* Optimize name field
* @param istances