Skip to content

Commit

Permalink
feat(column sizing): make onGridSizeChanged, onFirstDataRendered, and…
Browse files Browse the repository at this point in the history
… suppressColumnVirtualization configurable (#262)

* feat(column sizing): make onGridSizeChanged, onFirstDataRendered, and suppressColumnVirtualization configurable

* fix(Grid): default suppressColumnVirtualization to true

* fix(Grid): update how suppressColumnVirtualization default is handled
  • Loading branch information
jfee-linz authored Mar 15, 2023
1 parent 1c49df1 commit def4f8e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/components/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,20 @@ export interface GridProps {
autoSelectFirstRow?: boolean;
onColumnMoved?: GridOptions["onColumnMoved"];
alwaysShowVerticalScroll?: boolean;
onGridSizeChanged: GridOptions["onGridSizeChanged"];
onFirstDataRendered: GridOptions["onFirstDataRendered"];
suppressColumnVirtualization: GridOptions["suppressColumnVirtualisation"];
}

/**
* Wrapper for AgGrid to add commonly used functionality.
*/
export const Grid = ({ rowSelection = "multiple", "data-testid": dataTestId, ...params }: GridProps): JSX.Element => {
export const Grid = ({
"data-testid": dataTestId,
rowSelection = "multiple",
suppressColumnVirtualization = true,
...params
}: GridProps): JSX.Element => {
const {
gridReady,
setApis,
Expand Down Expand Up @@ -312,8 +320,9 @@ export const Grid = ({ rowSelection = "multiple", "data-testid": dataTestId, ...
rowSelection={rowSelection}
suppressBrowserResizeObserver={true}
colResizeDefault={"shift"}
onFirstDataRendered={sizeColumnsToFit}
onGridSizeChanged={sizeColumnsToFit}
onFirstDataRendered={params.onFirstDataRendered ?? sizeColumnsToFit}
onGridSizeChanged={params.onGridSizeChanged ?? sizeColumnsToFit}
suppressColumnVirtualisation={suppressColumnVirtualization}
suppressClickEdit={true}
onCellKeyPress={onCellKeyPress}
onCellClicked={onCellClicked}
Expand Down

0 comments on commit def4f8e

Please sign in to comment.