Skip to content

Commit

Permalink
feat(options): Allow access to properties that are deeper down the ob…
Browse files Browse the repository at this point in the history
…ject tree. (fixes #81)
  • Loading branch information
dtchau authored and valorkin committed Apr 11, 2016
1 parent ff96655 commit b7de4ad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/table/ng-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {NgTableSorting} from './ng-table-sorting.directive';
</thead>
<tbody>
<tr *ngFor="#row of rows">
<td *ngFor="#column of columns">{{row[column.name]}}</td>
<td *ngFor="#column of columns">{{getData(row, column.name)}}</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -69,4 +69,8 @@ export class NgTable {
this.columns = [column];
this.tableChanged.emit({sorting: this.configColumns});
}

getData(row:any, propertyName:string) {
return propertyName.split('.').reduce((prev, curr) => prev[curr], row);
}
}

0 comments on commit b7de4ad

Please sign in to comment.