fix(usepagination resetpage on globalfilter change): pageIndex reset (#1813)

autoReset pageIndex on globalFilter change

"fix #1812"
This commit is contained in:
Roman Ivaskevych
2020-01-08 16:33:25 -07:00
committed by Tanner Linsley
parent 8e310bd0e6
commit 2a0dc6778d
3 changed files with 12 additions and 9 deletions
+7 -7
View File
@@ -19,21 +19,21 @@
}
},
"dist\\index.js": {
"bundled": 104977,
"minified": 48560,
"gzipped": 13057
"bundled": 113237,
"minified": 52528,
"gzipped": 13837
},
"dist\\index.es.js": {
"bundled": 104090,
"minified": 47770,
"gzipped": 12900,
"bundled": 112300,
"minified": 51692,
"gzipped": 13671,
"treeshaked": {
"rollup": {
"code": 80,
"import_statements": 21
},
"webpack": {
"code": 8227
"code": 8461
}
}
}
+1
View File
@@ -30,6 +30,7 @@ The following options are supported via the main options object passed to `useTa
- When `true`, the `pageIndex` state will automatically reset if `manualPagination` is `false` and any of the following conditions are met:
- `data` is changed
- `manualSortBy` is `false` and `state.sortBy` is changed
- `manualGlobalFilter` is `false` and `state.globalFilter` is changed
- `manualFilters` is `false` and `state.filters` is changed
- `manualGroupBy` is `false` and `state.groupBy` is changed
- To disable, set to `false`
+4 -2
View File
@@ -76,10 +76,11 @@ function useInstance(instance) {
pageCount: userPageCount,
paginateExpandedRows = true,
expandSubRows = true,
state: { pageSize, pageIndex, expanded, filters, groupBy, sortBy },
state: { pageSize, pageIndex, expanded, globalFilter, filters, groupBy, sortBy },
dispatch,
data,
manualPagination,
manualGlobalFilter,
manualFilters,
manualGroupBy,
manualSortBy,
@@ -87,7 +88,7 @@ function useInstance(instance) {
ensurePluginOrder(
plugins,
['useFilters', 'useGroupBy', 'useSortBy', 'useExpanded'],
['useGlobalFilter', 'useFilters', 'useGroupBy', 'useSortBy', 'useExpanded'],
'usePagination',
[]
)
@@ -101,6 +102,7 @@ function useInstance(instance) {
}, [
dispatch,
manualPagination ? null : data,
manualPagination || manualGlobalFilter ? null : globalFilter,
manualPagination || manualFilters ? null : filters,
manualPagination || manualGroupBy ? null : groupBy,
manualPagination || manualSortBy ? null : sortBy,