Skip to content

Commit eba5865

Browse files
fix(grid): selectable index react to pageSize
1 parent 8232fcb commit eba5865

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

projects/angular/components/ui-grid/src/components/ui-grid-custom-paginator/ui-grid-custom-paginator.component.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,19 @@ export class UiGridCustomPaginatorComponent extends _MatPaginatorBase<MatPaginat
7474
return Math.min(this.length, (this.pageIndex + 1) * this.pageSize);
7575
}
7676

77+
set pageSize(value: number) {
78+
super.pageSize = value;
79+
80+
this._generatePossiblePages();
81+
}
82+
get pageSize(): number {
83+
return super.pageSize;
84+
}
85+
7786
set length(value: number) {
7887
super.length = value;
7988

80-
this.possiblePages = Array.from({ length: this.pageCount }, (_, i) => ({
81-
label: i + 1,
82-
value: i,
83-
}));
89+
this._generatePossiblePages();
8490
}
8591
get length() {
8692
return super.length;
@@ -115,4 +121,11 @@ export class UiGridCustomPaginatorComponent extends _MatPaginatorBase<MatPaginat
115121
length: this.length,
116122
});
117123
}
124+
125+
private _generatePossiblePages() {
126+
this.possiblePages = Array.from({ length: this.pageCount }, (_, i) => ({
127+
label: i + 1,
128+
value: i,
129+
}));
130+
}
118131
}

0 commit comments

Comments
 (0)