Skip to content

Commit 4d7cc4c

Browse files
RockerbyRichard Ockerby
andauthored
fix: have pagination render update when the total number of pages has changed (#364)
Co-authored-by: Richard Ockerby <[email protected]>
1 parent 7acd240 commit 4d7cc4c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/uui-pagination/lib/uui-pagination.element.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,23 @@ export class UUIPaginationElement extends LitElement {
160160
@property({ reflect: true, attribute: 'aria-label' })
161161
ariaLabel = '';
162162

163+
private _total = 100;
164+
163165
/**
164166
* Set the amount of pages to navigate.
165167
* @type {number}
166168
* @attr
167169
* @default: 1
168170
*/
169171
@property({ type: Number })
170-
total = 1;
172+
get total() {
173+
return this._total;
174+
}
175+
set total(newValue: number) {
176+
this._total = newValue;
177+
this._visiblePages = this._generateVisiblePages(this._current);
178+
this.requestUpdate('total', newValue);
179+
}
171180

172181
@state()
173182
private _range = 0;

0 commit comments

Comments
 (0)