Skip to content
Snippets Groups Projects
Commit 339d25bc authored by esikkala's avatar esikkala
Browse files

Update table pagination props

parent e1334fb0
No related branches found
No related tags found
No related merge requests found
......@@ -150,13 +150,13 @@ class ResultTable extends React.Component {
)
}
handleChangePage = (event, page) => {
handlePageChange = (event, page) => {
if (event != null && !this.props.data.fetching) {
this.props.updatePage(this.props.resultClass, page)
}
}
handleOnChangeRowsPerPage = event => {
handleRowsPerPageChange = event => {
const rowsPerPage = event.target.value
if (rowsPerPage !== this.props.data.pagesize) {
this.props.updateRowsPerPage(this.props.resultClass, rowsPerPage)
......@@ -299,8 +299,8 @@ class ResultTable extends React.Component {
inputProps: { 'aria-label': 'rows per page' },
native: true
}}
onChangePage={this.handleChangePage}
onChangeRowsPerPage={this.handleOnChangeRowsPerPage}
onPageChange={this.handlePageChange}
onRowsPerPageChange={this.handleRowsPerPageChange}
ActionsComponent={ResultTablePaginationActions}
/>
<div className={classes.tableContainer}>
......
......@@ -15,18 +15,18 @@ const styles = theme => ({
})
const ResultTablePaginationActions = props => {
const { theme, classes, count, page, rowsPerPage, onChangePage } = props
const { theme, classes, count, page, rowsPerPage, onPageChange } = props
const handleFirstPageButtonClick = event => {
onChangePage(event, 0)
onPageChange(event, 0)
}
const handleBackButtonClick = event => {
onChangePage(event, page - 1)
onPageChange(event, page - 1)
}
const handleNextButtonClick = event => {
onChangePage(event, page + 1)
onPageChange(event, page + 1)
}
const handleLastPageButtonClick = event => {
onChangePage(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1))
onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1))
}
return (
<div className={classes.root}>
......@@ -61,7 +61,7 @@ const ResultTablePaginationActions = props => {
ResultTablePaginationActions.propTypes = {
classes: PropTypes.object.isRequired,
count: PropTypes.number.isRequired,
onChangePage: PropTypes.func.isRequired,
onPageChange: PropTypes.func.isRequired,
page: PropTypes.number.isRequired,
rowsPerPage: PropTypes.number.isRequired,
theme: PropTypes.object.isRequired
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment