mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-22 16:06:19 -05:00
Adding default 'No results' row when sortable table has no rows.
This commit is contained in:
parent
3ad7b8af00
commit
c9f7520604
1 changed files with 8 additions and 1 deletions
|
|
@ -63,7 +63,14 @@ export class SortableTable extends React.Component {
|
|||
// Use placeholder while data is null.
|
||||
let rows = <TableRow><TableCell colSpan={tableHeaders.length}><TextPlaceholder/></TableCell></TableRow>;
|
||||
if (data !== null) {
|
||||
rows = data.map(i => <React.Fragment key={i[rowKey]}>{rowFunc(i, this.sortData)}</React.Fragment>);
|
||||
if (data.length > 0) {
|
||||
// Convert data to table rows.
|
||||
rows = data.map(i => <React.Fragment key={i[rowKey]}>{rowFunc(i, this.sortData)}</React.Fragment>);
|
||||
} else {
|
||||
// No results in data.
|
||||
rows = this.props.emptyRow
|
||||
|| <TableRow><TableCell colSpan={tableHeaders.length}>No results</TableCell></TableRow>;
|
||||
}
|
||||
}
|
||||
|
||||
return <Table sortable {...this.props.tableProps}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue