mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
add reset pagination (#3239)
This commit is contained in:
@@ -346,7 +346,7 @@
|
||||
(prevPage)="onPrevPage($event)">
|
||||
</adf-pagination>
|
||||
<adf-infinite-pagination
|
||||
*ngIf="infiniteScrolling"
|
||||
[hidden]="!infiniteScrolling"
|
||||
[target]="documentList"
|
||||
[loading]="documentList.infiniteLoading">
|
||||
{{ 'ADF-DOCUMENT-LIST.LAYOUT.LOAD_MORE' | translate }}
|
||||
@@ -448,7 +448,7 @@
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<mat-slide-toggle color="primary" [(ngModel)]="infiniteScrolling">
|
||||
<mat-slide-toggle color="primary" (click)="onInfiniteScrolling()">
|
||||
{{'DOCUMENT_LIST.ENABLE_INFINITE_SCROLL' | translate}}
|
||||
</mat-slide-toggle>
|
||||
</section>
|
||||
|
@@ -28,7 +28,7 @@ import {
|
||||
AuthenticationService, AppConfigService, ContentService, TranslationService,
|
||||
FileUploadEvent, FolderCreatedEvent, LogService, NotificationService,
|
||||
UploadService, DataColumn, DataRow, UserPreferencesService,
|
||||
PaginationComponent, FormValues, DisplayMode, UserPreferenceValues
|
||||
PaginationComponent, FormValues, DisplayMode, UserPreferenceValues, InfinitePaginationComponent
|
||||
} from '@alfresco/adf-core';
|
||||
|
||||
import { DocumentListComponent, PermissionStyleModel } from '@alfresco/adf-content-services';
|
||||
@@ -149,6 +149,10 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
@ViewChild('standardPagination')
|
||||
standardPagination: PaginationComponent;
|
||||
|
||||
@ViewChild(InfinitePaginationComponent)
|
||||
infinitePaginationComponent: InfinitePaginationComponent;
|
||||
|
||||
|
||||
permissionsStyle: PermissionStyleModel[] = [];
|
||||
infiniteScrolling: boolean;
|
||||
supportedPages: number[];
|
||||
@@ -349,9 +353,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
private reloadForInfiniteScrolling() {
|
||||
if (this.infiniteScrolling) {
|
||||
this.documentList.skipCount = 0;
|
||||
}
|
||||
this.documentList.reload();
|
||||
}
|
||||
|
||||
@@ -462,7 +463,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
this.turnedNextPage.emit(event);
|
||||
}
|
||||
|
||||
loadNextBatch(event: Pagination) {
|
||||
loadNextBatch(event: Pagination): void {
|
||||
this.loadNext.emit(event);
|
||||
}
|
||||
|
||||
@@ -484,4 +485,10 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
this.location.go(url);
|
||||
}
|
||||
}
|
||||
|
||||
onInfiniteScrolling(): void {
|
||||
this.infiniteScrolling = !this.infiniteScrolling;
|
||||
this.infinitePaginationComponent.reset();
|
||||
this.reloadForInfiniteScrolling();
|
||||
}
|
||||
}
|
||||
|
@@ -104,6 +104,11 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio
|
||||
}
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.pagination.skipCount = 0;
|
||||
this.target.updatePagination(this.pagination);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.paginationSubscription) {
|
||||
this.paginationSubscription.unsubscribe();
|
||||
|
Reference in New Issue
Block a user