mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
#82 emit single/double row click events
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<td *ngFor="#col of data.columns" [ngSwitch]="col.type"
|
<td *ngFor="#col of data.columns" [ngSwitch]="col.type"
|
||||||
class="mdl-data-table__cell--non-numeric data-cell {{col.cssClass}}"
|
class="mdl-data-table__cell--non-numeric data-cell {{col.cssClass}}"
|
||||||
(click)="onRowClicked(row, $event)">
|
(click)="onRowClick(row, $event)" (dblclick)="onRowDblClick(row, $event)">
|
||||||
<div *ngSwitchWhen="'image'">
|
<div *ngSwitchWhen="'image'">
|
||||||
<i *ngIf="isIconValue(row, col)" class="material-icons folder-thumbnail">{{asIconValue(row, col)}}</i>
|
<i *ngIf="isIconValue(row, col)" class="material-icons folder-thumbnail">{{asIconValue(row, col)}}</i>
|
||||||
<img *ngIf="!isIconValue(row, col)" class="document-thumbnail" alt="" src="{{data.getValue(row, col)}}">
|
<img *ngIf="!isIconValue(row, col)" class="document-thumbnail" alt="" src="{{data.getValue(row, col)}}">
|
||||||
|
@@ -47,7 +47,10 @@ export class DataTableComponent implements OnInit, AfterViewChecked {
|
|||||||
data: DataTableAdapter;
|
data: DataTableAdapter;
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
onRowClick: EventEmitter<any> = new EventEmitter();
|
rowClick: EventEmitter<any> = new EventEmitter();
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
rowDblClick: EventEmitter<any> = new EventEmitter();
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.data) {
|
if (this.data) {
|
||||||
@@ -64,12 +67,22 @@ export class DataTableComponent implements OnInit, AfterViewChecked {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onRowClicked(row: DataRow, e?) {
|
onRowClick(row: DataRow, e?) {
|
||||||
if (e) {
|
if (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onRowClick.emit({
|
this.rowClick.emit({
|
||||||
|
value: row
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onRowDblClick(row: DataRow, e?) {
|
||||||
|
if (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.rowDblClick.emit({
|
||||||
value: row
|
value: row
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user