diff options
author | Aijana Schumann <aijana.schumann@highstreet-technologies.com> | 2020-03-13 10:39:11 +0100 |
---|---|---|
committer | Aijana S <aijana.schumann@highstreet-technologies.com> | 2020-03-13 10:14:15 +0000 |
commit | ce78a6683ab8648ed90e944cd23ed7c01205fce6 (patch) | |
tree | 42bac21bac743bdf889639c732aa70b2f747eb29 /sdnr/wt/odlux/framework/src/components/material-table/utilities.ts | |
parent | f3bd99fbe11c443966fff14c6990367b36bdedc4 (diff) |
Fix odlux bugs
Fix help and about app not scrollable
Fix filter hiding and showing without user interaction and default sort in all tables
Issue-ID: SDNC-1117
Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Change-Id: I5c6ff86c73a3b222a8d9022125454788496f6399
Diffstat (limited to 'sdnr/wt/odlux/framework/src/components/material-table/utilities.ts')
-rw-r--r-- | sdnr/wt/odlux/framework/src/components/material-table/utilities.ts | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/sdnr/wt/odlux/framework/src/components/material-table/utilities.ts b/sdnr/wt/odlux/framework/src/components/material-table/utilities.ts index 74682cd95..07ffe2ff5 100644 --- a/sdnr/wt/odlux/framework/src/components/material-table/utilities.ts +++ b/sdnr/wt/odlux/framework/src/components/material-table/utilities.ts @@ -49,6 +49,12 @@ export function createExternal<TData>(callback: DataCallback<TData>, selectState } } + class RequestExplicitSortAction extends TableAction { + constructor(public propertyName: string, public sortOrder: "asc" | "desc") { + super(); + } + } + class SetSelectedAction extends TableAction { constructor(public selected: TData[] | null) { super(); @@ -136,7 +142,15 @@ export function createExternal<TData>(callback: DataCallback<TData>, selectState orderBy: state.orderBy === action.orderBy && state.order === 'desc' ? null : action.orderBy, order: state.orderBy === action.orderBy && state.order === 'asc' ? 'desc' : 'asc', } - } else if (action instanceof SetShowFilterAction) { + } else if (action instanceof RequestExplicitSortAction) { + state = { + ...state, + loading: true, + orderBy: action.propertyName, + order: action.sortOrder + } + } + else if (action instanceof SetShowFilterAction) { state = { ...state, loading: true, @@ -239,11 +253,18 @@ export function createExternal<TData>(callback: DataCallback<TData>, selectState (!skipRefresh) && dispatch(reloadAction); }); }, - onToggleFilter: () => { + onHandleExplicitRequestSort: (property: string, sortOrder: "asc" | "desc") => { + dispatch((dispatch: Dispatch) => { + dispatch(new RequestExplicitSortAction(property, sortOrder)); + (!skipRefresh) && dispatch(reloadAction); + }); + }, + onToggleFilter: (refresh?: boolean) => { dispatch((dispatch: Dispatch, getAppState: () => IApplicationStoreState) => { const { showFilter } = selectState(getAppState()); dispatch(new SetShowFilterAction(!showFilter)); - (!skipRefresh) && dispatch(reloadAction); + if (!skipRefresh && (refresh === undefined || refresh)) + dispatch(reloadAction); }); }, onFilterChanged: (property: string, filterTerm: string) => { |