Compare commits

...
Author SHA1 Message Date
Tanner Linsley 62cff3d6bc 5.0.3 2017-02-09 10:07:37 -07:00
Tanner Linsley 057a815337 Adjust current page if available pages dips below current page
Fixes #69
2017-02-09 10:07:33 -07:00
2 changed files with 8 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "react-table", "name": "react-table",
"version": "5.0.2", "version": "5.0.3",
"description": "A fast, lightweight, opinionated table and datagrid built on React", "description": "A fast, lightweight, opinionated table and datagrid built on React",
"license": "MIT", "license": "MIT",
"homepage": "https://github.com/tannerlinsley/react-table#readme", "homepage": "https://github.com/tannerlinsley/react-table#readme",
+7 -2
View File
@@ -10,7 +10,9 @@ export default {
pivotValKey, pivotValKey,
subRowsKey, subRowsKey,
expanderColumnWidth, expanderColumnWidth,
SubComponent SubComponent,
page,
pageSize
} = this.getResolvedState(nextProps, nextState) } = this.getResolvedState(nextProps, nextState)
// Determine Header Groups // Determine Header Groups
@@ -212,13 +214,16 @@ export default {
resolvedData = groupRecursively(resolvedData, pivotBy) resolvedData = groupRecursively(resolvedData, pivotBy)
} }
const newPages = Math.ceil(resolvedData.length / pageSize)
return { return {
resolvedData, resolvedData,
pivotColumn, pivotColumn,
allVisibleColumns, allVisibleColumns,
headerGroups, headerGroups,
allDecoratedColumns, allDecoratedColumns,
hasHeaderGroups hasHeaderGroups,
page: (page + 1) > newPages ? newPages - 1 : page
} }
}, },
getSortedData (nextProps, nextState) { getSortedData (nextProps, nextState) {