Account for empty dataset in Table component.

This commit is contained in:
Danny van Kooten 2016-12-24 10:12:20 +02:00
parent 9bd461f8d5
commit 42e3f2134b
1 changed files with 2 additions and 2 deletions

View File

@ -58,14 +58,14 @@ class Table extends Component {
}
render() {
const tableRows = this.state.records.map((p, i) => (
const tableRows = this.state.records.length > 0 ? this.state.records.map((p, i) => (
<tr>
<td class="muted">{i+1}</td>
{this.labelCell(p)}
<td>{numbers.formatWithComma(p.Value)}</td>
<td>{Math.round(p.PercentageValue)}%</td>
</tr>
));
)) :<tr><td colspan="4" class="italic">Nothing here..</td></tr>;
const loadingOverlay = this.state.loading ? <div class="loading-overlay"><div></div></div> : '';