Skip to content

Commit

Permalink
Re-add datagrid pagination checks
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Mar 8, 2022
1 parent 53ba2d5 commit 8c63cca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/datagrid/utils/focus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export const createKeyDownHandler = ({
setFocusedCell([x + 1, y]);
}
} else if (key === keys.PAGE_DOWN) {
if (pagination) {
if (pagination && pagination.pageSize > 0) {
event.preventDefault();
const pageSize = pagination.pageSize;
const pageCount = Math.ceil(rowCount / pageSize);
Expand All @@ -226,7 +226,7 @@ export const createKeyDownHandler = ({
setFocusedCell([focusedCell[0], 0]);
}
} else if (key === keys.PAGE_UP) {
if (pagination) {
if (pagination && pagination.pageSize > 0) {
event.preventDefault();
const pageIndex = pagination.pageIndex;
if (pageIndex > 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/datagrid/utils/ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const useSortPageCheck = (
: rowIndex;

// Account for pagination
if (pagination) {
if (pagination && pagination.pageSize > 0) {
const pageIndex = Math.floor(visibleRowIndex / pagination.pageSize);
// If the targeted row is on a different page than the current page,
// we should automatically navigate the user to the correct page
Expand Down

0 comments on commit 8c63cca

Please sign in to comment.