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