Skip to content

Commit adb478f

Browse files
committed
chore: enable multisort
1 parent 856217b commit adb478f

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
import { createElement, ReactElement } from "react";
2+
import { useGalleryRootScope } from "../helpers/root-context";
3+
import { getGlobalSortContext } from "@mendix/widget-plugin-sorting/context";
24

35
type GalleryHeaderProps = Omit<JSX.IntrinsicElements["div"], "ref">;
46

7+
const SortAPI = getGlobalSortContext();
8+
59
export function GalleryHeader(props: GalleryHeaderProps): ReactElement | null {
610
const { children } = props;
11+
const scope = useGalleryRootScope();
712

813
if (!children) {
914
return null;
1015
}
1116

12-
return <section {...props} className="widget-gallery-header widget-gallery-filter" />;
17+
return (
18+
<SortAPI.Provider value={scope.rootStore.sortAPI}>
19+
<section {...props} className="widget-gallery-header widget-gallery-filter" />
20+
</SortAPI.Provider>
21+
);
1322
}

packages/pluggableWidgets/gallery-web/src/controllers/QueryParamsController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { CustomFilterHost } from "@mendix/widget-plugin-filtering/stores/generic
33
import { DatasourceController } from "@mendix/widget-plugin-grid/query/DatasourceController";
44
import { disposeBatch } from "@mendix/widget-plugin-mobx-kit/disposeBatch";
55
import { ReactiveController, ReactiveControllerHost } from "@mendix/widget-plugin-mobx-kit/reactive-controller";
6-
import { ObservableSortStoreHost } from "@mendix/widget-plugin-sorting/observable-sort-host";
6+
import { ObservableSortStoreHost } from "@mendix/widget-plugin-sorting/ObservableSortStoreHost";
77
import { ListValue } from "mendix";
88
import { FilterCondition } from "mendix/filters";
99
import { makeAutoObservable, reaction } from "mobx";

packages/shared/widget-plugin-sorting/src/controllers/SortStoreProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export class SortStoreProvider implements ISetupable {
3737
setup(): () => void {
3838
const [add, disposeAll] = disposeBatch();
3939

40-
this._host.observe(this._key, this._store);
41-
add(() => this._host.unobserve(this._key));
40+
this._host.observe(this._store, this._key);
41+
add(() => this._host.unobserve(this._store));
4242
add(this._store.setup?.());
4343
return disposeAll;
4444
}

0 commit comments

Comments
 (0)