Modify `PaginatedTable`: let `ReactTable` handle the case where no data is available

This commit is contained in:
Shreya 2021-02-23 17:49:38 +05:30 committed by Mike Salvatore
parent 4aa9a14f13
commit db52f0966f
1 changed files with 12 additions and 18 deletions

View File

@ -4,25 +4,19 @@ import * as PropTypes from 'prop-types';
class PaginatedTable extends Component {
render() {
if (this.props.data.length > 0) {
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 defaultPageSize = this.props.data.length > this.props.pageSize ? this.props.pageSize : this.props.data.length;
let showPagination = this.props.data.length > this.props.pageSize;
return (
<div>
<ReactTable
columns={this.props.columns}
data={this.props.data}
showPagination={showPagination}
defaultPageSize={defaultPageSize}
/>
</div>
);
} else {
return (
<div/>
);
}
return (
<div>
<ReactTable
columns={this.props.columns}
data={this.props.data}
showPagination={showPagination}
defaultPageSize={defaultPageSize}
/>
</div>
);
}
}