Skip to content

Commit

Permalink
[Issue #14] Apply the new descending sort order to the comic list.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpierce committed Nov 23, 2019
1 parent 639e727 commit 2439856
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
[paginator]='true'
[rows]='rows'
[sortField]='sortField'
[sortOrder]='sortOrder'
[value]='comics|comicFilter:filters'
paginatorPosition='both'>
<ng-template let-comic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export class ComicListComponent implements OnInit, OnDestroy {
layoutSubscription: Subscription;
layout: string;
sortFieldSubscription: Subscription;
sortField: string;
sortField = '';
sortOrder = 1;
rowsSubscription: Subscription;
rows: number;
sameHeightSubscription: Subscription;
Expand Down Expand Up @@ -88,7 +89,15 @@ export class ComicListComponent implements OnInit, OnDestroy {
layout => (this.layout = layout)
);
this.sortFieldSubscription = this.libraryDisplayAdaptor.sortField$.subscribe(
sort_field => (this.sortField = sort_field)
sortField => {
if (sortField.indexOf('!') === 0) {
this.sortOrder = -1;
this.sortField = sortField.substr(1);
} else {
this.sortOrder = 1;
this.sortField = sortField;
}
}
);
this.rowsSubscription = this.libraryDisplayAdaptor.rows$.subscribe(
rows => (this.rows = rows)
Expand Down

0 comments on commit 2439856

Please sign in to comment.