You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
739 B
27 lines
739 B
import {MatPaginator, MatPaginatorIntl} from "@angular/material/paginator";
|
|
import {ChangeDetectorRef} from "@angular/core";
|
|
|
|
export class PagingAndSortingPaginator<T> {
|
|
data: T[] = [];
|
|
count: number = 0;
|
|
size: number = 0;
|
|
|
|
fromData(data: any) {
|
|
this.data = data['content'];
|
|
this.count = data['totalElements'];
|
|
this.size = data['size'];
|
|
return this;
|
|
}
|
|
|
|
static newObj():PagingAndSortingPaginator<any> {
|
|
return new PagingAndSortingPaginator<any>();
|
|
}
|
|
|
|
updatePaginator(paginator: MatPaginator) {
|
|
if (paginator == null)
|
|
paginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype);
|
|
paginator.pageSize = this.size;
|
|
paginator.length = this.count;
|
|
return this;
|
|
}
|
|
}
|
|
|