Sort projects list

This commit is contained in:
Adina Țeudan 2020-10-13 22:03:36 +03:00 committed by Timo Bejan
parent cbd1a2a9e3
commit adf62d2d8a
2 changed files with 5 additions and 4 deletions

View File

@ -35,7 +35,7 @@
</div>
<div class="table-content">
<div *ngFor="let pw of appStateService.allProjects | sortBy:'desc':'projectDate'"
<div *ngFor="let pw of appStateService.allProjects | sortBy:sortingOption.order:sortingOption.column"
[routerLink]="'/ui/projects/'+pw.project.projectId"
class="table-item pointer"
>

View File

@ -12,7 +12,8 @@ import { DoughnutChartConfig } from '../../components/simple-doughnut-chart/simp
class SortingOption {
label: string;
value: string;
order: string;
column: string;
}
@Component({
@ -24,8 +25,8 @@ export class ProjectListingScreenComponent implements OnInit {
public projectsChartData: DoughnutChartConfig [] = [];
public documentsChartData: DoughnutChartConfig [] = [];
public sortingOptions: SortingOption[] = [
{ label: 'Recent', value: '\'asc\':\'projectDate\'' },
{ label: 'Alphabetically', value: 'alphabetically' }
{ label: 'Recent', order: 'desc', column: 'projectDate' },
{ label: 'Alphabetically', order: 'asc', column: 'project.projectName' }
];
public sortingOption: SortingOption = this.sortingOptions[0];