Skip to content

Commit f5e1b7f

Browse files
Johaney-sHejdaJakub
authored andcommitted
fix(admin): fix pagination label for estimated number of results
1 parent e7eb2db commit f5e1b7f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

libs/perun/services/src/lib/custom-mat-paginator.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@ import { MatPaginatorIntl } from '@angular/material/paginator';
55
export class CustomMatPaginator extends MatPaginatorIntl {
66
getRangeLabel = function (page: number, pageSize: number, length: number): string {
77
let estimatedLength: string;
8+
const start = page * pageSize + 1;
9+
const range = (page + 1) * pageSize;
10+
const end = range > length ? length : range;
11+
812
if (length < 1000) {
9-
estimatedLength = String(length);
13+
return `${start}${end} of ${String(length)}`;
1014
} else if (length < 10000) {
1115
estimatedLength = '1 000';
1216
} else if (length < 100000) {
1317
estimatedLength = '10 000';
1418
} else {
1519
estimatedLength = '100 000';
1620
}
17-
const start = page * pageSize + 1;
18-
const end = (page + 1) * pageSize;
21+
1922
return `${start}${end} of ${estimatedLength} +`;
2023
};
2124
}

0 commit comments

Comments
 (0)