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

[WC-2706]: Control over stored filters #1379

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/pluggableWidgets/datagrid-web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Added

- We introduced a setting to exclude filters from being stored in the Personalization configuration.

## [2.28.2] - 2024-12-12

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion packages/pluggableWidgets/datagrid-web/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@mendix/datagrid-web",
"widgetName": "Datagrid",
"version": "2.28.2",
"version": "2.28.3",
"description": "",
"copyright": "© Mendix Technology BV 2023. All rights reserved.",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/pluggableWidgets/datagrid-web/src/Datagrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions packages/pluggableWidgets/datagrid-web/src/Datagrid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@
<caption>On change</caption>
<description />
</property>
<property key="storeFiltersInPersonalization" type="boolean" defaultValue="true">
<caption>Store filters</caption>
<description />
</property>
</propertyGroup>
</propertyGroup>
<propertyGroup caption="Grid wide filtering">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ describe("Datagrid", () => {
filterList: [],
configurationStorageType: "attribute",
configurationAttribute: undefined,
loadingType: "spinner"
loadingType: "spinner",
storeFiltersInPersonalization: true
};
const user = userEvent.setup();
let renderCount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -30,6 +31,7 @@ export class GridPersonalizationStore {
) {
this.gridName = props.name;
this.gridColumnsHash = getHash(this.columnsStore._allColumns, this.gridName);
this.storeFilters = props.storeFiltersInPersonalization;

makeObservable<GridPersonalizationStore, "applySettings">(this, {
settings: computed,
Expand Down Expand Up @@ -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()
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/pluggableWidgets/datagrid-web/src/package.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<package xmlns="http://www.mendix.com/package/1.0/">
<clientModule name="Datagrid" version="2.28.2" xmlns="http://www.mendix.com/clientModule/1.0/">
<clientModule name="Datagrid" version="2.28.3" xmlns="http://www.mendix.com/clientModule/1.0/">
<widgetFiles>
<widgetFile path="Datagrid.xml" />
</widgetFiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export interface DatagridContainerProps {
columnsHidable: boolean;
configurationStorageType: ConfigurationStorageTypeEnum;
configurationAttribute?: EditableValue<string>;
storeFiltersInPersonalization: boolean;
filterList: FilterListType[];
filtersPlaceholder?: ReactNode;
filterSectionTitle?: DynamicValue<string>;
Expand Down Expand Up @@ -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;
Expand Down
Loading