Fix error on paginated table persistence

This commit is contained in:
jeffvli 2023-02-08 10:05:10 -08:00
parent 9f2e873366
commit 822dcd8429
4 changed files with 28 additions and 13 deletions

View file

@ -131,9 +131,13 @@ export const AlbumListContent = ({
(event: PaginationChangedEvent) => {
if (!isPaginationEnabled || !event.api) return;
// Scroll to top of page on pagination change
const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage;
event.api?.ensureIndexVisible(currentPageStartIndex, 'top');
try {
// Scroll to top of page on pagination change
const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage;
event.api?.ensureIndexVisible(currentPageStartIndex, 'top');
} catch (err) {
console.log(err);
}
setPagination({
itemsPerPage: event.api.paginationGetPageSize(),