@shival99/z-ui 1.7.5 → 1.7.7

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.
@@ -3693,22 +3693,19 @@ class ZTableComponent {
3693
3693
  });
3694
3694
  explicitEffect([this.columnFilters, this.globalFilter, this.pagination, this.sorting, this._data], () => {
3695
3695
  if (this.isVirtual()) {
3696
- this._dynamicGroupsVersion.update(v => v + 1);
3696
+ // CRITICAL: Reset scroll position SYNCHRONOUSLY before dynamicGroups recomputes
3697
+ // This ensures virtualizer calculates range from offset 0
3697
3698
  const wrapperEl = this.tbodyWrapper()?.nativeElement;
3698
3699
  if (wrapperEl) {
3699
3700
  wrapperEl.scrollTop = 0;
3700
3701
  }
3701
- this.virtualizer.scrollToOffset(0);
3702
+ // Force virtualizer to reset measurements and use offset 0
3702
3703
  this.virtualizer.measure();
3704
+ this.virtualizer.scrollToOffset(0, { align: 'start' });
3705
+ // Now update version to trigger recomputation
3706
+ this._dynamicGroupsVersion.update(v => v + 1);
3703
3707
  }
3704
3708
  queueMicrotask(() => {
3705
- if (this.isVirtual()) {
3706
- const wrapperEl = this.tbodyWrapper()?.nativeElement;
3707
- if (wrapperEl && wrapperEl.scrollTop !== 0) {
3708
- wrapperEl.scrollTop = 0;
3709
- this.virtualizer.scrollToOffset(0);
3710
- }
3711
- }
3712
3709
  this._checkVerticalScroll();
3713
3710
  this._checkHorizontalScroll();
3714
3711
  });
@@ -3737,10 +3734,6 @@ class ZTableComponent {
3737
3734
  wrapperEl.scrollTop = 0;
3738
3735
  wrapperEl.scrollLeft = this._savedScrollLeft();
3739
3736
  }
3740
- if (this.isVirtual()) {
3741
- this.virtualizer.scrollToOffset(0);
3742
- this.virtualizer.measure();
3743
- }
3744
3737
  this._checkScrollState();
3745
3738
  });
3746
3739
  });