@servicemind.tis/tis-smart-table-viewer 2.4.13 → 2.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2491,20 +2491,29 @@ class TisSmartTableViewerComponent {
2491
2491
  this.resetFlag = false;
2492
2492
  }
2493
2493
  onPaginationChanges() {
2494
- if (this.pageIndex != this._paginator.pageIndex) {
2495
- this.pageIndex = this._paginator.pageIndex;
2494
+ // Read both new values up front. Changing the page size on a non-first page
2495
+ // makes mat-paginator recompute pageIndex AND pageSize in a single event;
2496
+ // handling them in two separate getList() calls used to fail because the
2497
+ // first call writes the (still old) pageSize back onto the paginator
2498
+ // (see getList), making the second comparison false and dropping the new
2499
+ // page size. Capture both, apply both, and load once.
2500
+ const newPageIndex = this._paginator.pageIndex;
2501
+ const newPageSize = this._paginator.pageSize;
2502
+ const pageIndexChanged = this.pageIndex != newPageIndex;
2503
+ const pageSizeChanged = this.pageSize != newPageSize;
2504
+ if (pageIndexChanged || pageSizeChanged) {
2505
+ this.pageIndex = newPageIndex;
2506
+ this.pageSize = newPageSize;
2496
2507
  // Clear computed backgrounds before loading new page data
2497
2508
  this.clearRowBackgroundCache();
2498
2509
  this.getList();
2499
- this.pageIndexChange.emit(this.pageIndex);
2500
- }
2501
- if (this.pageSize != this._paginator.pageSize) {
2502
- this.pageSize = this._paginator.pageSize;
2503
- // Clear computed backgrounds before loading new page size data
2504
- this.clearRowBackgroundCache();
2505
- this.getList();
2506
- this.pageSizeChange.emit(this.pageSize);
2507
- setToLocalStorageWithExpiry('user_pagination_page_size', this.pageSize, 1000 * 60 * 60 * 24 * 15);
2510
+ if (pageIndexChanged) {
2511
+ this.pageIndexChange.emit(this.pageIndex);
2512
+ }
2513
+ if (pageSizeChanged) {
2514
+ this.pageSizeChange.emit(this.pageSize);
2515
+ setToLocalStorageWithExpiry('user_pagination_page_size', this.pageSize, 1000 * 60 * 60 * 24 * 15);
2516
+ }
2508
2517
  }
2509
2518
  }
2510
2519
  onSetSelectedTemplate(data) {