[ADF-4042] fix reset pagination issue when enter in a folder (#4281)

* fix reset pagination issue when enter in a folder

* fix pagination new folder issue and infintie pagiantion
This commit is contained in:
Eugenio Romano
2019-02-07 21:30:46 +00:00
committed by GitHub
parent 9915935714
commit 8fa335aced
6 changed files with 83 additions and 56 deletions

View File

@@ -104,6 +104,7 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio
reset() {
this.pagination.skipCount = 0;
this.pagination.maxItems = this.pageSize;
this.target.updatePagination(this.pagination);
}

View File

@@ -25,7 +25,7 @@ import { PaginatedComponent } from './paginated-component.interface';
import { PaginationComponentInterface } from './pagination-component.interface';
import { Subscription } from 'rxjs';
import { PaginationModel } from '../models/pagination.model';
import { UserPreferencesService } from '../services/user-preferences.service';
import { UserPreferencesService, UserPreferenceValues } from '../services/user-preferences.service';
@Component({
selector: 'adf-pagination',
@@ -60,7 +60,7 @@ export class PaginationComponent implements OnInit, OnDestroy, PaginationCompone
/** Pagination object. */
@Input()
pagination: PaginationModel;
pagination: PaginationModel = PaginationComponent.DEFAULT_PAGINATION;
/** Emitted when pagination changes in any way. */
@Output()
@@ -85,17 +85,14 @@ export class PaginationComponent implements OnInit, OnDestroy, PaginationCompone
private paginationSubscription: Subscription;
constructor(private cdr: ChangeDetectorRef, private userPreferencesService: UserPreferencesService) {
this.userPreferencesService.select(UserPreferenceValues.PaginationSize).subscribe((pagSize) => {
this.pagination.maxItems = pagSize;
});
}
ngOnInit() {
if (!this.pagination) {
let defaultPagination = PaginationComponent.DEFAULT_PAGINATION;
defaultPagination.maxItems = this.userPreferencesService.paginationSize;
this.pagination = defaultPagination;
}
if (!this.supportedPageSizes) {
this.supportedPageSizes = this.userPreferencesService.supportedPageSizes;
this.supportedPageSizes = this.userPreferencesService.supportedPageSizes;
}
if (this.target) {
@@ -213,7 +210,7 @@ export class PaginationComponent implements OnInit, OnDestroy, PaginationCompone
onChangePageSize(maxItems: number) {
this.pagination.skipCount = 0;
this.pagination.maxItems = maxItems;
this.userPreferencesService.paginationSize = maxItems;
this.handlePaginationEvent(PaginationComponent.ACTIONS.CHANGE_PAGE_SIZE, {
skipCount: 0,
maxItems