Merge pull request #4758 from GabrielInTheWorld/util-fixes

Hotfix for pagination in motion-list
This commit is contained in:
Emanuel Schütze 2019-06-04 17:13:35 +02:00 committed by GitHub
commit 5e33c500c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View File

@ -124,23 +124,24 @@ export abstract class ListViewBaseComponent<
this.dataSource.paginator._intl.itemsPerPageLabel = this.translate.instant('items per page'); this.dataSource.paginator._intl.itemsPerPageLabel = this.translate.instant('items per page');
} }
// TODO: Add subscription to this.subscriptions
if (this.modelFilterListService && this.modelSortService) { if (this.modelFilterListService && this.modelSortService) {
// filtering and sorting // filtering and sorting
this.modelFilterListService.initFilters(this.getModelListObservable()); this.modelFilterListService.initFilters(this.getModelListObservable());
this.modelSortService.initSorting(this.modelFilterListService.outputObservable); this.modelSortService.initSorting(this.modelFilterListService.outputObservable);
this.modelSortService.outputObservable.subscribe(data => this.setDataSource(data)); this.subscriptions.push(this.modelSortService.outputObservable.subscribe(data => this.setDataSource(data)));
} else if (this.modelFilterListService) { } else if (this.modelFilterListService) {
// only filter service // only filter service
this.modelFilterListService.initFilters(this.getModelListObservable()); this.modelFilterListService.initFilters(this.getModelListObservable());
this.modelFilterListService.outputObservable.subscribe(data => this.setDataSource(data)); this.subscriptions.push(
this.modelFilterListService.outputObservable.subscribe(data => this.setDataSource(data))
);
} else if (this.modelSortService) { } else if (this.modelSortService) {
// only sorting // only sorting
this.modelSortService.initSorting(this.getModelListObservable()); this.modelSortService.initSorting(this.getModelListObservable());
this.modelSortService.outputObservable.subscribe(data => this.setDataSource(data)); this.subscriptions.push(this.modelSortService.outputObservable.subscribe(data => this.setDataSource(data)));
} else { } else {
// none of both // none of both
this.getModelListObservable().subscribe(data => this.setDataSource(data)); this.subscriptions.push(this.getModelListObservable().subscribe(data => this.setDataSource(data)));
} }
} }

View File

@ -157,8 +157,6 @@
> >
</mat-row> </mat-row>
</mat-table> </mat-table>
<mat-paginator class="on-transition-fade" [pageSizeOptions]="pageSize"></mat-paginator>
</span> </span>
<span *ngSwitchCase="'tiles'"> <span *ngSwitchCase="'tiles'">
<os-grid-layout> <os-grid-layout>
@ -182,6 +180,8 @@
</os-grid-layout> </os-grid-layout>
</span> </span>
</div> </div>
<mat-paginator [style.display]="selectedView === 'list' ? 'block' : 'none'" class="on-transition-fade" [pageSizeOptions]="pageSize"></mat-paginator>
</mat-drawer-container> </mat-drawer-container>
<mat-menu #motionListMenu="matMenu"> <mat-menu #motionListMenu="matMenu">

View File

@ -492,6 +492,9 @@ export class MotionListComponent extends ListViewBaseComponent<ViewMotion, Motio
public onChangeView(value: string): void { public onChangeView(value: string): void {
this.selectedView = value; this.selectedView = value;
this.storage.set('motionListView', value); this.storage.set('motionListView', value);
if (value === 'list') {
this.initTable();
}
} }
/** /**