pagination is modified
This commit is contained in:
parent
0c686a458b
commit
eab09924ba
|
@ -153,9 +153,9 @@
|
||||||
|
|
||||||
<mat-paginator
|
<mat-paginator
|
||||||
#paginator
|
#paginator
|
||||||
[length]="'10'"
|
[length]="dataSource.page.totalElements"
|
||||||
[pageIndex]="0"
|
[pageIndex]="0"
|
||||||
[pageSize]="10"
|
[pageSize]="20"
|
||||||
[pageSizeOptions]="[5, 10, 25, 100]"
|
[pageSizeOptions]="[5, 10, 25, 100]"
|
||||||
>
|
>
|
||||||
</mat-paginator>
|
</mat-paginator>
|
||||||
|
|
|
@ -9,9 +9,11 @@ import { CollectionViewer } from '@angular/cdk/collections';
|
||||||
|
|
||||||
import { User } from 'src/modules/user/model/user.model';
|
import { User } from 'src/modules/user/model/user.model';
|
||||||
import { UserService } from 'src/modules/user/service/user.service';
|
import { UserService } from 'src/modules/user/service/user.service';
|
||||||
|
import { Page } from 'src/modules/common/data/model/page';
|
||||||
|
|
||||||
export class UsersDataSource extends DataSource<User> {
|
export class UsersDataSource extends DataSource<User> {
|
||||||
private filterSubject = new BehaviorSubject('');
|
private filterSubject = new BehaviorSubject('');
|
||||||
|
private pageSubject = new BehaviorSubject<Page<User>>({});
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
|
@ -30,6 +32,14 @@ export class UsersDataSource extends DataSource<User> {
|
||||||
this.filterSubject.next(filter);
|
this.filterSubject.next(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get page(): Page<User> {
|
||||||
|
return this.pageSubject.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set page(value: Page<User>) {
|
||||||
|
this.pageSubject.next(value);
|
||||||
|
}
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
collectionViewer: CollectionViewer
|
collectionViewer: CollectionViewer
|
||||||
): Observable<User[] | readonly User[]> {
|
): Observable<User[] | readonly User[]> {
|
||||||
|
@ -49,6 +59,7 @@ export class UsersDataSource extends DataSource<User> {
|
||||||
|
|
||||||
return this.userService.getUsers().pipe(
|
return this.userService.getUsers().pipe(
|
||||||
map(page => {
|
map(page => {
|
||||||
|
this.page = page;
|
||||||
return page.content;
|
return page.content;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>UCAP APM</title>
|
<title>Banana Sound Backend</title>
|
||||||
<base href="/" />
|
<base href="/" />
|
||||||
|
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
|
|
@ -13,15 +13,15 @@ export interface Pageable {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Page<T> {
|
export interface Page<T> {
|
||||||
content: T[] | null;
|
content?: T[] | null;
|
||||||
empty: boolean;
|
empty?: boolean;
|
||||||
first: boolean;
|
first?: boolean;
|
||||||
last: boolean;
|
last?: boolean;
|
||||||
number: number;
|
number?: number;
|
||||||
numberOfElements: number;
|
numberOfElements?: number;
|
||||||
pageable: Pageable;
|
pageable?: Pageable;
|
||||||
size: number;
|
size?: number;
|
||||||
sort: Sort;
|
sort?: Sort;
|
||||||
totalElements: number;
|
totalElements?: number;
|
||||||
totalPages: number;
|
totalPages?: number;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user