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
When using manual pagination it does not seem to be possible to use the selectedFlatRows field to store selected rows across multiple pages. Instead I use the following strategy:
const getRowId = (row: RowType) => row.id
const tableInstance = useTable({ ..., manualPagination: true, getRowId }, [usePagination, useRowSelect])
// Keys of selectedRowIds now work across multiple pages
const selectedRowIds = state.selectedRowIds
The seems to work well with the only exception that toggleAllRowSelected(false) will only work for the current page. The workaround is to call dispatch({ type: 'resetSelectedRows' }) instead which clears the state.selectedRowIds. It would be helpful if this was returned in the table instance as well as the other methods.
Unless I am missing something and there is a much better way to do this, but there doesn't seem a more logical way that selectedFlatRows could be kept when using manual pagination.
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.
-
When using manual pagination it does not seem to be possible to use the selectedFlatRows field to store selected rows across multiple pages. Instead I use the following strategy:
The seems to work well with the only exception that toggleAllRowSelected(false) will only work for the current page. The workaround is to call
dispatch({ type: 'resetSelectedRows' })
instead which clears the state.selectedRowIds. It would be helpful if this was returned in the table instance as well as the other methods.Unless I am missing something and there is a much better way to do this, but there doesn't seem a more logical way that
selectedFlatRows
could be kept when using manual pagination.Beta Was this translation helpful? Give feedback.
All reactions