diff --git a/__tests__/demo/demo-components/index.js b/__tests__/demo/demo-components/index.js index b5e92fe1..96152da1 100644 --- a/__tests__/demo/demo-components/index.js +++ b/__tests__/demo/demo-components/index.js @@ -1349,7 +1349,8 @@ export function TableMultiSorting(props) { selection: false, maxColumnSort: 2, defaultOrderByCollection: orderCollection, - showColumnSortOrder: true + showColumnSortOrder: true, + draggable: true }} onOrderCollectionChange={onOrderCollectionChange} /> diff --git a/src/material-table.js b/src/material-table.js index 41673bcd..75934476 100644 --- a/src/material-table.js +++ b/src/material-table.js @@ -448,9 +448,6 @@ export default class MaterialTable extends React.Component { isRemoteData = (props) => !Array.isArray((props || this.props).data); - isOutsidePageNumbers = (props) => - props.page !== undefined && props.totalCount !== undefined; - onAllSelected = (checked) => { this.dataManager.changeAllSelected( checked, @@ -521,9 +518,7 @@ export default class MaterialTable extends React.Component { this.props.onPageChange(page, query.pageSize); }); } else { - if (!this.isOutsidePageNumbers(this.props)) { - this.dataManager.changeCurrentPage(page); - } + this.dataManager.changeCurrentPage(page); this.setState(this.dataManager.getRenderState(), () => { this.props.onPageChange && this.props.onPageChange(page, this.state.pageSize); @@ -924,14 +919,13 @@ export default class MaterialTable extends React.Component { ...this.props.localization.pagination }; - const isOutsidePageNumbers = this.isOutsidePageNumbers(props); - const currentPage = isOutsidePageNumbers + const currentPage = this.isRemoteData() ? Math.min( props.page, Math.floor(props.totalCount / this.state.pageSize) ) : this.state.currentPage; - const totalCount = isOutsidePageNumbers + const totalCount = this.isRemoteData() ? props.totalCount : this.state.data.length;