mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
committed by
Eugenio Romano
parent
d77db4e8f6
commit
a9d61e5d6e
@@ -22,11 +22,13 @@ import {
|
||||
Input,
|
||||
OnInit,
|
||||
Output,
|
||||
ViewEncapsulation
|
||||
ViewEncapsulation,
|
||||
ChangeDetectorRef
|
||||
} from '@angular/core';
|
||||
|
||||
import { Pagination } from 'alfresco-js-api';
|
||||
import { PaginationQueryParams } from './pagination-query-params.interface';
|
||||
import { PaginatedComponent } from './paginated-component.interface';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-pagination',
|
||||
@@ -53,6 +55,9 @@ export class PaginationComponent implements OnInit {
|
||||
CHANGE_PAGE_NUMBER: 'CHANGE_PAGE_NUMBER'
|
||||
};
|
||||
|
||||
@Input()
|
||||
target: PaginatedComponent;
|
||||
|
||||
@Input()
|
||||
supportedPageSizes: number[] = [ 25, 50, 100 ];
|
||||
|
||||
@@ -74,7 +79,16 @@ export class PaginationComponent implements OnInit {
|
||||
@Output()
|
||||
prevPage: EventEmitter<Pagination> = new EventEmitter<Pagination>();
|
||||
|
||||
constructor(private cdr: ChangeDetectorRef) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.target) {
|
||||
this.target.pagination.subscribe(page => {
|
||||
this.pagination = page;
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
if (!this.pagination) {
|
||||
this.pagination = PaginationComponent.DEFAULT_PAGINATION;
|
||||
}
|
||||
@@ -201,5 +215,9 @@ export class PaginationComponent implements OnInit {
|
||||
}
|
||||
|
||||
change.emit(params);
|
||||
|
||||
if (this.target) {
|
||||
this.target.updatePagination(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user