#82 emit single/double row click events

This commit is contained in:
Denys Vuika
2016-05-19 17:02:40 +01:00
parent 533626dcb8
commit 90452d34f8
2 changed files with 17 additions and 4 deletions

View File

@@ -47,7 +47,10 @@ export class DataTableComponent implements OnInit, AfterViewChecked {
data: DataTableAdapter;
@Output()
onRowClick: EventEmitter<any> = new EventEmitter();
rowClick: EventEmitter<any> = new EventEmitter();
@Output()
rowDblClick: EventEmitter<any> = new EventEmitter();
ngOnInit() {
if (this.data) {
@@ -64,12 +67,22 @@ export class DataTableComponent implements OnInit, AfterViewChecked {
}
}
onRowClicked(row: DataRow, e?) {
onRowClick(row: DataRow, e?) {
if (e) {
e.preventDefault();
}
this.onRowClick.emit({
this.rowClick.emit({
value: row
});
}
onRowDblClick(row: DataRow, e?) {
if (e) {
e.preventDefault();
}
this.rowDblClick.emit({
value: row
});
}