From ce78a6683ab8648ed90e944cd23ed7c01205fce6 Mon Sep 17 00:00:00 2001 From: Aijana Schumann Date: Fri, 13 Mar 2020 10:39:11 +0100 Subject: 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 Change-Id: I5c6ff86c73a3b222a8d9022125454788496f6399 --- .../src/components/material-table/utilities.ts | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'sdnr/wt/odlux/framework/src/components/material-table/utilities.ts') 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(callback: DataCallback, 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(callback: DataCallback, 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(callback: DataCallback, 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) => { -- cgit 1.2.3-korg