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 { ...@@ -150,13 +150,13 @@ class ResultTable extends React.Component {
) )
} }
handleChangePage = (event, page) => { handlePageChange = (event, page) => {
if (event != null && !this.props.data.fetching) { if (event != null && !this.props.data.fetching) {
this.props.updatePage(this.props.resultClass, page) this.props.updatePage(this.props.resultClass, page)
} }
} }
handleOnChangeRowsPerPage = event => { handleRowsPerPageChange = event => {
const rowsPerPage = event.target.value const rowsPerPage = event.target.value
if (rowsPerPage !== this.props.data.pagesize) { if (rowsPerPage !== this.props.data.pagesize) {
this.props.updateRowsPerPage(this.props.resultClass, rowsPerPage) this.props.updateRowsPerPage(this.props.resultClass, rowsPerPage)
...@@ -299,8 +299,8 @@ class ResultTable extends React.Component { ...@@ -299,8 +299,8 @@ class ResultTable extends React.Component {
inputProps: { 'aria-label': 'rows per page' }, inputProps: { 'aria-label': 'rows per page' },
native: true native: true
}} }}
onChangePage={this.handleChangePage} onPageChange={this.handlePageChange}
onChangeRowsPerPage={this.handleOnChangeRowsPerPage} onRowsPerPageChange={this.handleRowsPerPageChange}
ActionsComponent={ResultTablePaginationActions} ActionsComponent={ResultTablePaginationActions}
/> />
<div className={classes.tableContainer}> <div className={classes.tableContainer}>
......
...@@ -15,18 +15,18 @@ const styles = theme => ({ ...@@ -15,18 +15,18 @@ const styles = theme => ({
}) })
const ResultTablePaginationActions = props => { const ResultTablePaginationActions = props => {
const { theme, classes, count, page, rowsPerPage, onChangePage } = props const { theme, classes, count, page, rowsPerPage, onPageChange } = props
const handleFirstPageButtonClick = event => { const handleFirstPageButtonClick = event => {
onChangePage(event, 0) onPageChange(event, 0)
} }
const handleBackButtonClick = event => { const handleBackButtonClick = event => {
onChangePage(event, page - 1) onPageChange(event, page - 1)
} }
const handleNextButtonClick = event => { const handleNextButtonClick = event => {
onChangePage(event, page + 1) onPageChange(event, page + 1)
} }
const handleLastPageButtonClick = event => { const handleLastPageButtonClick = event => {
onChangePage(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1)) onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1))
} }
return ( return (
<div className={classes.root}> <div className={classes.root}>
...@@ -61,7 +61,7 @@ const ResultTablePaginationActions = props => { ...@@ -61,7 +61,7 @@ const ResultTablePaginationActions = props => {
ResultTablePaginationActions.propTypes = { ResultTablePaginationActions.propTypes = {
classes: PropTypes.object.isRequired, classes: PropTypes.object.isRequired,
count: PropTypes.number.isRequired, count: PropTypes.number.isRequired,
onChangePage: PropTypes.func.isRequired, onPageChange: PropTypes.func.isRequired,
page: PropTypes.number.isRequired, page: PropTypes.number.isRequired,
rowsPerPage: PropTypes.number.isRequired, rowsPerPage: PropTypes.number.isRequired,
theme: PropTypes.object.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