Skip to content

Commit

Permalink
feat(table): add rowClassFunction (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashuraits authored and lexzhukov committed May 25, 2017
1 parent e8cf1d9 commit 845c8cf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion 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 this.grid.getRows()" (click)="userSelectRow.emit(row)" (mouseover)="rowHover.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" [className]="rowClassFunction(row)" [ngClass]="{selected: row.isSelected}">
<td *ngIf="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
3 changes: 2 additions & 1 deletion src/ng2-smart-table/components/tbody/tbody.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export class Ng2SmartTableTbodyComponent {
@Input() source: DataSource;
@Input() deleteConfirm: EventEmitter<any>;
@Input() editConfirm: EventEmitter<any>;

@Input() rowClassFunction:Function;

@Output() save = new EventEmitter<any>();
@Output() cancel = new EventEmitter<any>();
@Output() edit = new EventEmitter<any>();
Expand Down
1 change: 1 addition & 0 deletions src/ng2-smart-table/ng2-smart-table.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
[source]="source"
[deleteConfirm]="deleteConfirm"
[editConfirm]="editConfirm"
[rowClassFunction]="grid.getSetting('rowClassFunction')"
(edit)="edit.emit($event)"
(delete)="delete.emit($event)"
(custom)="custom.emit($event)"
Expand Down
1 change: 1 addition & 0 deletions src/ng2-smart-table/ng2-smart-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class Ng2SmartTableComponent implements OnChanges {
display: true,
perPage: 10,
},
rowClassFunction: () => ""
};

isAllSelected: boolean = false;
Expand Down

0 comments on commit 845c8cf

Please sign in to comment.