[30561] Always reload when switching to manual mode

pull/7473/head
Oliver Günther 5 years ago
parent 7ac2805779
commit 1b20f3ecf1
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 22
      frontend/src/app/components/wp-fast-table/state/wp-table-sort-by.service.ts

@ -69,8 +69,12 @@ export class WorkPackageTableSortByService extends WorkPackageQueryStateService<
}
public applyToQuery(query:QueryResource) {
const wasManuallySorted = this.isManuallySorted(query.sortBy);
query.sortBy = [...this.current];
return !this.isManualSortingMode;
// Reload every time unless we stayed in manual sort mode
return !(wasManuallySorted && this.isManualSortingMode);
}
public isSortable(column:QueryColumn):boolean {
@ -113,13 +117,7 @@ export class WorkPackageTableSortByService extends WorkPackageQueryStateService<
}
public get isManualSortingMode():boolean {
let current = this.current;
if (current && current.length > 0) {
return current[0].column.href!.endsWith('/manualSorting');
}
return false;
return this.isManuallySorted(this.current);
}
public switchToManualSorting() {
@ -141,6 +139,14 @@ export class WorkPackageTableSortByService extends WorkPackageQueryStateService<
return this.availableState.getValueOr([]);
}
private isManuallySorted(sortBy:QuerySortByResource[]):boolean {
if (sortBy && sortBy.length > 0) {
return sortBy[0].column.href!.endsWith('/manualSorting');
}
return false;
}
private get manualSortObject() {
return _.find(this.available, sort => {
return sort.column.$href!.endsWith('/manualSorting');

Loading…
Cancel
Save