[ADF-2016] pagination integration for document list (#2718)

* pagination integration for document list

* reload data only if needed

* unit tests for document list

* pagination tests

* update docs
This commit is contained in:
Denys Vuika
2017-11-27 10:14:08 +00:00
committed by Eugenio Romano
parent d77db4e8f6
commit a9d61e5d6e
9 changed files with 263 additions and 93 deletions

View File

@@ -116,10 +116,9 @@
</button>
</mat-menu>
</adf-toolbar>
<adf-document-list
#documentList
[maxItems]="currentMaxItems"
[skipCount]="currentSkipCount"
[enableInfiniteScrolling]="infiniteScrolling"
[permissionsStyle]="permissionsStyle"
[currentFolderId]="currentFolderId"
@@ -274,7 +273,7 @@
#standardPagination
*ngIf="!infiniteScrolling"
class="adf-documentlist-pagination"
[pagination]="pagination"
[target]="documentList"
[supportedPageSizes]="supportedPages"
(changePageSize)="onChangePageSize($event)"
(changePageNumber)="onChangePageNumber($event)"

View File

@@ -126,8 +126,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
permissionsStyle: PermissionStyleModel[] = [];
supportedPages: number[] = [5, 10, 15, 20];
infiniteScrolling: boolean;
currentMaxItems: number;
currentSkipCount: number = 0;
private onCreateFolder: Subscription;
private onEditFolder: Subscription;
@@ -169,7 +167,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
maxItems: this.preference.paginationSize,
skipCount: 0
};
this.currentMaxItems = this.preference.paginationSize;
}
if (this.route) {
this.route.params.forEach((params: Params) => {
@@ -446,32 +443,22 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
onChangePageSize(event: Pagination): void {
this.preference.paginationSize = event.maxItems;
this.currentMaxItems = event.maxItems;
this.currentSkipCount = event.skipCount;
this.changedPageSize.emit(event);
}
onChangePageNumber(event: Pagination): void {
this.currentMaxItems = event.maxItems;
this.currentSkipCount = event.skipCount;
this.changedPageNumber.emit(event);
}
onNextPage(event: Pagination): void {
this.currentMaxItems = event.maxItems;
this.currentSkipCount = event.skipCount;
this.turnedNextPage.emit(event);
}
loadNextBatch(event: Pagination) {
this.currentMaxItems = event.maxItems;
this.currentSkipCount = event.skipCount;
this.loadNext.emit(event);
}
onPrevPage(event: Pagination): void {
this.currentMaxItems = event.maxItems;
this.currentSkipCount = event.skipCount;
this.turnedPreviousPage.emit(event);
}
}