Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for variable row heights #2384

Merged
merged 20 commits into from
May 4, 2021
Prev Previous commit
Next Next commit
Fix tests
  • Loading branch information
Aman Mahajan committed May 3, 2021
commit 8f8124b97301f6d78a34c2e76d05c0ea514bbb9b
15 changes: 11 additions & 4 deletions src/DataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -794,10 +794,17 @@ function DataGrid<R, SR>({
// If row is selected then move focus to the last row.
if (isRowSelected) return { idx, rowIdx: rows.length - 1 };
return ctrlKey ? { idx: columns.length - 1, rowIdx: rows.length - 1 } : { idx: columns.length - 1, rowIdx };
// case 'PageUp':
// return { idx, rowIdx: rowIdx - Math.floor(clientHeight / rowHeight) };
// case 'PageDown':
// return { idx, rowIdx: rowIdx + Math.floor(clientHeight / rowHeight) };
case 'PageUp':
// TODO: handle variable row height
if (typeof rowHeight === 'number') {
return { idx, rowIdx: rowIdx - Math.floor(clientHeight / rowHeight) };
}
break;
case 'PageDown':
if (typeof rowHeight === 'number') {
return { idx, rowIdx: rowIdx + Math.floor(clientHeight / rowHeight) };
}
break;
default:
return selectedPosition;
}
Expand Down