From 9cc2b948dec584f299aaf2970307bad4d8e3d393 Mon Sep 17 00:00:00 2001 From: Sirazh Gabdullin Date: Wed, 19 Apr 2023 22:21:00 +0600 Subject: [PATCH 1/3] Fix logic when pageSize larger than number of rows Signed-off-by: Sirazh Gabdullin --- src/components/datagrid/data_grid.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/datagrid/data_grid.tsx b/src/components/datagrid/data_grid.tsx index 3ed5002f2f..247bc9b87d 100644 --- a/src/components/datagrid/data_grid.tsx +++ b/src/components/datagrid/data_grid.tsx @@ -715,6 +715,10 @@ export const OuiDataGrid: FunctionComponent = (props) => { ...rest } = props; + if (pagination) { + pagination.pageSize = Math.min(pagination.pageSize, rowCount); + } + const [isFullScreen, setIsFullScreen] = useState(false); const [gridWidth, setGridWidth] = useState(0); From def1f49666df82ef47ab552b3bb032d5807cd053 Mon Sep 17 00:00:00 2001 From: Sirazh Gabdullin Date: Thu, 20 Apr 2023 19:30:14 +0600 Subject: [PATCH 2/3] Remove incorrect fix Signed-off-by: Sirazh Gabdullin --- src/components/datagrid/data_grid.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/components/datagrid/data_grid.tsx b/src/components/datagrid/data_grid.tsx index 247bc9b87d..3ed5002f2f 100644 --- a/src/components/datagrid/data_grid.tsx +++ b/src/components/datagrid/data_grid.tsx @@ -715,10 +715,6 @@ export const OuiDataGrid: FunctionComponent = (props) => { ...rest } = props; - if (pagination) { - pagination.pageSize = Math.min(pagination.pageSize, rowCount); - } - const [isFullScreen, setIsFullScreen] = useState(false); const [gridWidth, setGridWidth] = useState(0); From f78e2c436974c02138fbde37b335c73d4c89ca38 Mon Sep 17 00:00:00 2001 From: Sirazh Gabdullin Date: Thu, 20 Apr 2023 19:36:45 +0600 Subject: [PATCH 3/3] Fix logic when pageSize larger than number of rows Signed-off-by: Sirazh Gabdullin --- src/components/datagrid/data_grid_body.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/datagrid/data_grid_body.tsx b/src/components/datagrid/data_grid_body.tsx index b67372621d..cb8679fa7c 100644 --- a/src/components/datagrid/data_grid_body.tsx +++ b/src/components/datagrid/data_grid_body.tsx @@ -629,7 +629,7 @@ export const OuiDataGridBody: FunctionComponent = ( }, [getRowHeight]); const rowCountToAffordFor = pagination - ? pagination.pageSize + ? Math.min(pagination.pageSize, rowCount) : visibleRowIndices.length; const unconstrainedHeight = defaultHeight * rowCountToAffordFor + headerRowHeight + footerRowHeight;