From 23ca37cc1675340552003f7acec46f12c060da2b Mon Sep 17 00:00:00 2001 From: kaga Date: Fri, 30 Aug 2024 13:46:38 +1200 Subject: [PATCH] feat: SRVTRI-3123 Add defaultPostSort option (#470) --- src/components/Grid.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Grid.tsx b/src/components/Grid.tsx index ef662b39..6ca951a1 100644 --- a/src/components/Grid.tsx +++ b/src/components/Grid.tsx @@ -39,6 +39,7 @@ export interface GridBaseRow { export interface GridProps { readOnly?: boolean; // set all editables to false when read only, make all styles black, otherwise style is gray for not editable + defaultPostSort?: boolean; // Retain sort order after edit, Defaults to true. selectable?: boolean; theme?: string; // should have prefix ag-theme- ["data-testid"]?: string; @@ -114,6 +115,7 @@ export interface GridProps { */ export const Grid = ({ "data-testid": dataTestId, + defaultPostSort = true, rowSelection = "multiple", suppressColumnVirtualization = true, theme = "ag-theme-step-default", @@ -742,7 +744,7 @@ export const Grid = ({ onModelUpdated={onModelUpdated} onGridReady={onGridReady} onSortChanged={ensureSelectedRowIsVisible} - postSortRows={params.onRowDragEnd ? undefined : postSortRows} + postSortRows={params.onRowDragEnd || !defaultPostSort ? undefined : postSortRows} onSelectionChanged={synchroniseExternalStateToGridSelection} onColumnMoved={params.onColumnMoved} alwaysShowVerticalScroll={params.alwaysShowVerticalScroll}