Skip to content

Commit

Permalink
fix(row): add a rowHover event emitter to the ng2-smart-table component
Browse files Browse the repository at this point in the history
  • Loading branch information
vvandoorne authored and lexzhukov committed Mar 29, 2017
1 parent 653bb34 commit 68b73ee
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/ng2-smart-table/components/tbody/tbody.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<tr *ngFor="let row of grid.getRows()" (click)="userSelectRow.emit(row)" (mouseover)="mouseover.emit(row)" class="ng2-smart-row" [ngClass]="{selected: row.isSelected}">
<tr *ngFor="let row of grid.getRows()" (click)="userSelectRow.emit(row)" (mouseover)="rowHover.emit(row)" class="ng2-smart-row" [ngClass]="{selected: row.isSelected}">
<td *ngIf="grid.isMultiSelectVisible()" class="ng2-smart-actions ng2-smart-action-multiple-select" (click)="multipleSelectRow.emit(row)">
<input type="checkbox" class="form-control" [ngModel]="row.isSelected">
</td>
Expand Down Expand Up @@ -49,4 +49,4 @@
<td [attr.colspan]="grid.getColumns().length + (grid.getSetting('actions.add') || grid.getSetting('actions.edit') || grid.getSetting('actions.delete'))">
{{ grid.getSetting('noDataMessage') }}
</td>
</tr>
</tr>
2 changes: 1 addition & 1 deletion src/ng2-smart-table/components/tbody/tbody.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ export class Ng2SmartTableTbodyComponent {
@Output() userSelectRow = new EventEmitter<any>();
@Output() editRowSelect = new EventEmitter<any>();
@Output() multipleSelectRow = new EventEmitter<any>();
@Output() mouseover = new EventEmitter<any>();
@Output() rowHover = new EventEmitter<any>();
}
3 changes: 2 additions & 1 deletion src/ng2-smart-table/ng2-smart-table.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
(delete)="delete.emit($event)"
(userSelectRow)="onUserSelectRow($event)"
(editRowSelect)="editRowSelect($event)"
(multipleSelectRow)="multipleSelectRow($event)">
(multipleSelectRow)="multipleSelectRow($event)"
(rowHover)="onRowHover($event)">
</tbody>

</table>
Expand Down
5 changes: 5 additions & 0 deletions src/ng2-smart-table/ng2-smart-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class Ng2SmartTableComponent implements OnChanges {
@Output() deleteConfirm = new EventEmitter<any>();
@Output() editConfirm = new EventEmitter<any>();
@Output() createConfirm = new EventEmitter<any>();
@Output() rowHover: EventEmitter<any> = new EventEmitter<any>();

grid: Grid;
defaultSettings: Object = {
Expand Down Expand Up @@ -103,6 +104,10 @@ export class Ng2SmartTableComponent implements OnChanges {
}
}

onRowHover(row: Row) {
this.rowHover.emit(row);
}

multipleSelectRow(row: Row) {
this.grid.multipleSelectRow(row);
this.emitUserSelectRow(row);
Expand Down

0 comments on commit 68b73ee

Please sign in to comment.