diff --git a/packages/pluggableWidgets/datagrid-web/src/Datagrid.tsx b/packages/pluggableWidgets/datagrid-web/src/Datagrid.tsx index f6e47f56c4..d97f9ea253 100644 --- a/packages/pluggableWidgets/datagrid-web/src/Datagrid.tsx +++ b/packages/pluggableWidgets/datagrid-web/src/Datagrid.tsx @@ -61,7 +61,7 @@ const Container = observer((props: Props): ReactElement => { onClickTrigger: props.onClickTrigger, onClick: props.onClick }); - useOnResetFiltersEvent(props.rootStore.staticInfo.name, props.rootStore.staticInfo.filtersChannelName); + useOnResetFiltersEvent(rootStore.staticInfo.name, rootStore.staticInfo.filtersChannelName); const visibleColumnsCount = selectActionHelper.showCheckboxColumn ? columnsStore.visibleColumns.length + 1 diff --git a/packages/pluggableWidgets/datagrid-web/src/Datagrid.xml b/packages/pluggableWidgets/datagrid-web/src/Datagrid.xml index a955ee3ec0..5eab609b16 100644 --- a/packages/pluggableWidgets/datagrid-web/src/Datagrid.xml +++ b/packages/pluggableWidgets/datagrid-web/src/Datagrid.xml @@ -336,6 +336,10 @@ On change + + Store filters + + diff --git a/packages/pluggableWidgets/datagrid-web/src/__tests__/perf.spec.tsx b/packages/pluggableWidgets/datagrid-web/src/__tests__/perf.spec.tsx index dfe902ccce..2f715764e7 100644 --- a/packages/pluggableWidgets/datagrid-web/src/__tests__/perf.spec.tsx +++ b/packages/pluggableWidgets/datagrid-web/src/__tests__/perf.spec.tsx @@ -84,7 +84,8 @@ describe("Datagrid", () => { filterList: [], configurationStorageType: "attribute", configurationAttribute: undefined, - loadingType: "spinner" + loadingType: "spinner", + storeFiltersInPersonalization: true }; const user = userEvent.setup(); let renderCount = 0; diff --git a/packages/pluggableWidgets/datagrid-web/src/helpers/state/GridPersonalizationStore.ts b/packages/pluggableWidgets/datagrid-web/src/helpers/state/GridPersonalizationStore.ts index 2aeaee0dbb..dbcbd05e9f 100644 --- a/packages/pluggableWidgets/datagrid-web/src/helpers/state/GridPersonalizationStore.ts +++ b/packages/pluggableWidgets/datagrid-web/src/helpers/state/GridPersonalizationStore.ts @@ -18,6 +18,7 @@ export class GridPersonalizationStore { private readonly gridName: string; private readonly gridColumnsHash: string; private readonly schemaVersion: GridPersonalizationStorageSettings["schemaVersion"] = 2; + private readonly storeFilters: boolean; private storage: PersonalizationStorage; @@ -30,6 +31,7 @@ export class GridPersonalizationStore { ) { this.gridName = props.name; this.gridColumnsHash = getHash(this.columnsStore._allColumns, this.gridName); + this.storeFilters = props.storeFiltersInPersonalization; makeObservable(this, { settings: computed, @@ -134,8 +136,8 @@ export class GridPersonalizationStore { this.gridName, this.gridColumnsHash, this.columnsStore.columnSettings, - this.columnsStore.filterSettings, - this.headerFilters.settings + this.storeFilters ? this.columnsStore.filterSettings : new Map(), + this.storeFilters ? this.headerFilters.settings : new Map() ); } } diff --git a/packages/pluggableWidgets/datagrid-web/typings/DatagridProps.d.ts b/packages/pluggableWidgets/datagrid-web/typings/DatagridProps.d.ts index f479524f3b..feb8482514 100644 --- a/packages/pluggableWidgets/datagrid-web/typings/DatagridProps.d.ts +++ b/packages/pluggableWidgets/datagrid-web/typings/DatagridProps.d.ts @@ -131,6 +131,7 @@ export interface DatagridContainerProps { columnsHidable: boolean; configurationStorageType: ConfigurationStorageTypeEnum; configurationAttribute?: EditableValue; + storeFiltersInPersonalization: boolean; filterList: FilterListType[]; filtersPlaceholder?: ReactNode; filterSectionTitle?: DynamicValue; @@ -177,6 +178,7 @@ export interface DatagridPreviewProps { configurationStorageType: ConfigurationStorageTypeEnum; configurationAttribute: string; onConfigurationChange: {} | null; + storeFiltersInPersonalization: boolean; filterList: FilterListPreviewType[]; filtersPlaceholder: { widgetCount: number; renderer: ComponentType<{ children: ReactNode; caption?: string }> }; filterSectionTitle: string;