Fix error on paginated table persistence
This commit is contained in:
parent
9f2e873366
commit
822dcd8429
4 changed files with 28 additions and 13 deletions
|
@ -131,9 +131,13 @@ export const AlbumListContent = ({
|
||||||
(event: PaginationChangedEvent) => {
|
(event: PaginationChangedEvent) => {
|
||||||
if (!isPaginationEnabled || !event.api) return;
|
if (!isPaginationEnabled || !event.api) return;
|
||||||
|
|
||||||
// Scroll to top of page on pagination change
|
try {
|
||||||
const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage;
|
// Scroll to top of page on pagination change
|
||||||
event.api?.ensureIndexVisible(currentPageStartIndex, 'top');
|
const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage;
|
||||||
|
event.api?.ensureIndexVisible(currentPageStartIndex, 'top');
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
|
||||||
setPagination({
|
setPagination({
|
||||||
itemsPerPage: event.api.paginationGetPageSize(),
|
itemsPerPage: event.api.paginationGetPageSize(),
|
||||||
|
|
|
@ -124,9 +124,13 @@ export const AlbumArtistListContent = ({ gridRef, tableRef }: AlbumArtistListCon
|
||||||
(event: PaginationChangedEvent) => {
|
(event: PaginationChangedEvent) => {
|
||||||
if (!isPaginationEnabled || !event.api) return;
|
if (!isPaginationEnabled || !event.api) return;
|
||||||
|
|
||||||
// Scroll to top of page on pagination change
|
try {
|
||||||
const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage;
|
// Scroll to top of page on pagination change
|
||||||
event.api?.ensureIndexVisible(currentPageStartIndex, 'top');
|
const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage;
|
||||||
|
event.api?.ensureIndexVisible(currentPageStartIndex, 'top');
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
|
||||||
setPagination({
|
setPagination({
|
||||||
itemsPerPage: event.api.paginationGetPageSize(),
|
itemsPerPage: event.api.paginationGetPageSize(),
|
||||||
|
|
|
@ -107,9 +107,13 @@ export const PlaylistListContent = ({ tableRef, itemCount }: PlaylistListContent
|
||||||
(event: PaginationChangedEvent) => {
|
(event: PaginationChangedEvent) => {
|
||||||
if (!isPaginationEnabled || !event.api) return;
|
if (!isPaginationEnabled || !event.api) return;
|
||||||
|
|
||||||
// Scroll to top of page on pagination change
|
try {
|
||||||
const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage;
|
// Scroll to top of page on pagination change
|
||||||
event.api?.ensureIndexVisible(currentPageStartIndex, 'top');
|
const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage;
|
||||||
|
event.api?.ensureIndexVisible(currentPageStartIndex, 'top');
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
|
||||||
setPagination({
|
setPagination({
|
||||||
itemsPerPage: event.api.paginationGetPageSize(),
|
itemsPerPage: event.api.paginationGetPageSize(),
|
||||||
|
|
|
@ -104,10 +104,13 @@ export const SongListContent = ({ customFilters, itemCount, tableRef }: SongList
|
||||||
(event: PaginationChangedEvent) => {
|
(event: PaginationChangedEvent) => {
|
||||||
if (!isPaginationEnabled || !event.api) return;
|
if (!isPaginationEnabled || !event.api) return;
|
||||||
|
|
||||||
// Scroll to top of page on pagination change
|
try {
|
||||||
const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage;
|
// Scroll to top of page on pagination change
|
||||||
event.api?.ensureIndexVisible(currentPageStartIndex, 'top');
|
const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage;
|
||||||
|
event.api?.ensureIndexVisible(currentPageStartIndex, 'top');
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
setPagination({
|
setPagination({
|
||||||
itemsPerPage: event.api.paginationGetPageSize(),
|
itemsPerPage: event.api.paginationGetPageSize(),
|
||||||
totalItems: event.api.paginationGetRowCount(),
|
totalItems: event.api.paginationGetRowCount(),
|
||||||
|
|
Reference in a new issue