Sort by ID rather than date by default

master
Nikola Forró 7 years ago
parent 24d0eaf2a2
commit de1e94ff0b

@ -13,7 +13,7 @@
</div> </div>
<mat-table class="quotes-table mat-elevation-z8" [dataSource]="dataSource" <mat-table class="quotes-table mat-elevation-z8" [dataSource]="dataSource"
matSort matSortActive="date" matSortDirection="desc" matSortDisableClear> matSort matSortActive="id" matSortDirection="desc" matSortDisableClear>
<ng-container matColumnDef="id"> <ng-container matColumnDef="id">

@ -53,7 +53,7 @@ export class QuotesComponent implements OnInit, AfterViewInit {
ngOnInit() { ngOnInit() {
this.dataSource = new QuotesDataSource(this.quotesService); this.dataSource = new QuotesDataSource(this.quotesService);
this.dataSource.loadQuotes('', 'date', 'desc', 0, 10); this.dataSource.loadQuotes('', 'id', 'desc', 0, 10);
} }
ngAfterViewInit() { ngAfterViewInit() {

@ -20,7 +20,7 @@ export class QuotesService {
constructor(private http: HttpClient) { } constructor(private http: HttpClient) { }
findQuotes( findQuotes(
filter = '', sortBy = 'date', sortOrder = 'desc', filter = '', sortBy = 'id', sortOrder = 'desc',
pageNumber = 0, pageSize = 10): Observable<Quotes> { pageNumber = 0, pageSize = 10): Observable<Quotes> {
return this.http.get('/quotes/api/quotes', { return this.http.get('/quotes/api/quotes', {

Loading…
Cancel
Save