From 0dcf5275f8647ff2a60c8ebad8699d907162a89b Mon Sep 17 00:00:00 2001 From: Wieland Lindenthal Date: Fri, 7 Sep 2018 16:43:19 +0200 Subject: [PATCH] Enforce mutual exclusiveness of hierarchies and sort by --- .../wp-fast-table/state/wp-table-hierarchy.service.ts | 7 ++++++- .../wp-fast-table/state/wp-table-sort-by.service.ts | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/components/wp-fast-table/state/wp-table-hierarchy.service.ts b/frontend/src/app/components/wp-fast-table/state/wp-table-hierarchy.service.ts index 43bdb5a74f..3a064fceec 100644 --- a/frontend/src/app/components/wp-fast-table/state/wp-table-hierarchy.service.ts +++ b/frontend/src/app/components/wp-fast-table/state/wp-table-hierarchy.service.ts @@ -42,11 +42,16 @@ export class WorkPackageTableHierarchiesService extends WorkPackageTableBaseServ state.current = active; state.last = null; - // hierarchies and group by are mutually exclusive if (active) { + // hierarchies and group by are mutually exclusive var groupBy = this.tableState.groupBy.value!; groupBy.current = undefined; this.tableState.groupBy.putValue(groupBy); + + // hierarchies and sort by are mutually exclusive + var sortBy = this.tableState.sortBy.value!; + sortBy.current = []; + this.tableState.sortBy.putValue(sortBy); } this.state.putValue(state); diff --git a/frontend/src/app/components/wp-fast-table/state/wp-table-sort-by.service.ts b/frontend/src/app/components/wp-fast-table/state/wp-table-sort-by.service.ts index 2188c18152..4536718023 100644 --- a/frontend/src/app/components/wp-fast-table/state/wp-table-sort-by.service.ts +++ b/frontend/src/app/components/wp-fast-table/state/wp-table-sort-by.service.ts @@ -77,6 +77,14 @@ export class WorkPackageTableSortByService extends WorkPackageTableBaseService 0) { + // hierarchies and sort by are mutually exclusive + var hierarchies = this.tableState.hierarchies.value!; + hierarchies.current = false; + hierarchies.last = null; + this.tableState.hierarchies.putValue(hierarchies); + query.hierarchies = hierarchies.current; + } query.sortBy = cloneHalResourceCollection(this.current.current); return true; }