forked from p15670423/monkey
Modify `PaginatedTable`: let `ReactTable` handle the case where no data is available
This commit is contained in:
parent
4aa9a14f13
commit
db52f0966f
|
@ -4,25 +4,19 @@ import * as PropTypes from 'prop-types';
|
||||||
|
|
||||||
class PaginatedTable extends Component {
|
class PaginatedTable extends Component {
|
||||||
render() {
|
render() {
|
||||||
if (this.props.data.length > 0) {
|
let defaultPageSize = this.props.data.length > this.props.pageSize ? this.props.pageSize : this.props.data.length;
|
||||||
let defaultPageSize = this.props.data.length > this.props.pageSize ? this.props.pageSize : this.props.data.length;
|
let showPagination = this.props.data.length > this.props.pageSize;
|
||||||
let showPagination = this.props.data.length > this.props.pageSize;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<ReactTable
|
<ReactTable
|
||||||
columns={this.props.columns}
|
columns={this.props.columns}
|
||||||
data={this.props.data}
|
data={this.props.data}
|
||||||
showPagination={showPagination}
|
showPagination={showPagination}
|
||||||
defaultPageSize={defaultPageSize}
|
defaultPageSize={defaultPageSize}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
return (
|
|
||||||
<div/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue