Permalink
Browse files

feat(project): Add nested object support

  • Loading branch information...
jeremyvergnas committed May 11, 2016
1 parent fc0e05e commit b26395d553fcbc770e2b24bf0db4a65e977fd2fb
Showing with 12 additions and 1 deletion.
  1. +1 −1 src/data-table.html
  2. +11 −0 src/data-table.js
@@ -14,7 +14,7 @@
<!-- Columns -->
<td repeat.for="columnLabel of columnLabels">
<a click.delegate="selected(row)">${row[columnLabel.column]}</a>
<a click.delegate="selected(row)">${displayValue(row, columnLabel.column)}</a>
</td>
<!-- Actions -->
@@ -1,5 +1,6 @@
import {bindable, inject, computedFrom} from 'aurelia-framework';
import {Router} from 'aurelia-router';
import {Statham} from 'json-statham';
@inject(Router, Element)
export class DataTable {
@@ -117,5 +118,15 @@ export class DataTable {
.catch(error => {
console.error('Something went wrong.', error);
});
displayValue (row, propertyName) {
if (row[propertyName]) {
return row[propertyName];
}
let statham = new Statham(row, Statham.MODE_NESTED);
return statham.fetch(propertyName);
}
isObject (columnName) {
return (columnName.indexOf('.') !== -1);
}
}

0 comments on commit b26395d

Please sign in to comment.