You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started with pagination implementation using react table and it was working as expected , but when I add other features like column filter, sort by hooks then pagination is breaking. Like when I click on second page or select another page data is always setting back to first page.
Please share , if you any body has examples for combining pagination with filter and sort hooks
below is the code I have.
const {
getTableProps,
getTableBodyProps,
headerGroups,
prepareRow,
page,
canPreviousPage,
canNextPage,
pageOptions,
pageCount,
gotoPage,
nextPage,
previousPage,
setPageSize,
// Get the state from the instance
state: { pageIndex, pageSize },
} = useTable(
{
columns,
data,
initialState: { pageIndex: 0 }, // Pass our hoisted table state
manualPagination: true, // Tell the usePagination
pageCount: controlledPageCount,
defaultColumn, // Be sure to pass the defaultColumn option
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All,
I started with pagination implementation using react table and it was working as expected , but when I add other features like column filter, sort by hooks then pagination is breaking. Like when I click on second page or select another page data is always setting back to first page.
Please share , if you any body has examples for combining pagination with filter and sort hooks
below is the code I have.
const {
getTableProps,
getTableBodyProps,
headerGroups,
prepareRow,
page,
canPreviousPage,
canNextPage,
pageOptions,
pageCount,
gotoPage,
nextPage,
previousPage,
setPageSize,
// Get the state from the instance
state: { pageIndex, pageSize },
} = useTable(
{
columns,
data,
initialState: { pageIndex: 0 }, // Pass our hoisted table state
manualPagination: true, // Tell the usePagination
pageCount: controlledPageCount,
defaultColumn, // Be sure to pass the defaultColumn option
Beta Was this translation helpful? Give feedback.
All reactions