@syncfusion/ej2-lists 27.2.3 → 27.2.5

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.
@@ -3266,9 +3266,10 @@ var Virtualization = /** @__PURE__ @class */ (function () {
3266
3266
  */
3267
3267
  Virtualization.prototype.uiVirtualization = function () {
3268
3268
  this.wireScrollEvent(false);
3269
- var isRendered = this.listViewInstance.isRendered;
3270
- var firstIndex = isRendered && !isNullOrUndefined(this.uiFirstIndex) ? this.uiFirstIndex : 0;
3271
3269
  var curViewDS = this.listViewInstance.curViewDS;
3270
+ var isRendered = this.listViewInstance.isRendered;
3271
+ var firstIndex = isRendered && !isNullOrUndefined(this.uiFirstIndex) && this.uiLastIndex <= Object.keys(curViewDS).length
3272
+ ? this.uiFirstIndex : 0;
3272
3273
  var firstDs = curViewDS.slice(firstIndex, firstIndex + 1);
3273
3274
  this.listViewInstance.ulElement = this.listViewInstance.curUL = ListBase.createList(this.listViewInstance.createElement, firstDs, this.listViewInstance.listBaseOption, null, this.listViewInstance);
3274
3275
  this.listViewInstance.contentContainer = this.listViewInstance.createElement('div', { className: classNames.container });
@@ -3277,7 +3278,8 @@ var Virtualization = /** @__PURE__ @class */ (function () {
3277
3278
  this.listItemHeight = this.listViewInstance.ulElement.firstElementChild.getBoundingClientRect().height;
3278
3279
  this.expectedDomItemCount = this.ValidateItemCount(10000);
3279
3280
  this.updateDOMItemCount();
3280
- var lastIndex = isRendered && !isNullOrUndefined(this.uiLastIndex) ? this.uiLastIndex : this.domItemCount - 1;
3281
+ var lastIndex = isRendered && !isNullOrUndefined(this.uiLastIndex) && this.listDiff !== 0
3282
+ ? this.uiLastIndex : this.domItemCount - 1;
3281
3283
  this.uiFirstIndex = firstIndex;
3282
3284
  this.uiLastIndex = lastIndex;
3283
3285
  var otherDs = curViewDS.slice(firstIndex + 1, lastIndex + 1);
@@ -3293,7 +3295,7 @@ var Virtualization = /** @__PURE__ @class */ (function () {
3293
3295
  this.bottomElement.style.height = isRendered ? (this.totalHeight - this.topElementHeight) + 'px' : this.totalHeight + 'px';
3294
3296
  this.topElementHeight = isRendered ? this.topElementHeight : 0;
3295
3297
  this.bottomElementHeight = isRendered ? (this.totalHeight - this.topElementHeight) : this.totalHeight;
3296
- this.listDiff = isRendered ? this.listDiff : 0;
3298
+ this.listDiff = isRendered && Object.keys(curViewDS).length !== this.domItemCount ? this.listDiff : 0;
3297
3299
  if (isRendered) {
3298
3300
  this.listViewInstance.element.scrollTop = this.listViewInstance.previousScrollTop;
3299
3301
  }