@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.
@@ -3227,9 +3227,10 @@ class Virtualization {
3227
3227
  */
3228
3228
  uiVirtualization() {
3229
3229
  this.wireScrollEvent(false);
3230
- const isRendered = this.listViewInstance.isRendered;
3231
- const firstIndex = isRendered && !isNullOrUndefined(this.uiFirstIndex) ? this.uiFirstIndex : 0;
3232
3230
  const curViewDS = this.listViewInstance.curViewDS;
3231
+ const isRendered = this.listViewInstance.isRendered;
3232
+ const firstIndex = isRendered && !isNullOrUndefined(this.uiFirstIndex) && this.uiLastIndex <= Object.keys(curViewDS).length
3233
+ ? this.uiFirstIndex : 0;
3233
3234
  const firstDs = curViewDS.slice(firstIndex, firstIndex + 1);
3234
3235
  this.listViewInstance.ulElement = this.listViewInstance.curUL = ListBase.createList(this.listViewInstance.createElement, firstDs, this.listViewInstance.listBaseOption, null, this.listViewInstance);
3235
3236
  this.listViewInstance.contentContainer = this.listViewInstance.createElement('div', { className: classNames.container });
@@ -3238,7 +3239,8 @@ class Virtualization {
3238
3239
  this.listItemHeight = this.listViewInstance.ulElement.firstElementChild.getBoundingClientRect().height;
3239
3240
  this.expectedDomItemCount = this.ValidateItemCount(10000);
3240
3241
  this.updateDOMItemCount();
3241
- const lastIndex = isRendered && !isNullOrUndefined(this.uiLastIndex) ? this.uiLastIndex : this.domItemCount - 1;
3242
+ const lastIndex = isRendered && !isNullOrUndefined(this.uiLastIndex) && this.listDiff !== 0
3243
+ ? this.uiLastIndex : this.domItemCount - 1;
3242
3244
  this.uiFirstIndex = firstIndex;
3243
3245
  this.uiLastIndex = lastIndex;
3244
3246
  const otherDs = curViewDS.slice(firstIndex + 1, lastIndex + 1);
@@ -3254,7 +3256,7 @@ class Virtualization {
3254
3256
  this.bottomElement.style.height = isRendered ? (this.totalHeight - this.topElementHeight) + 'px' : this.totalHeight + 'px';
3255
3257
  this.topElementHeight = isRendered ? this.topElementHeight : 0;
3256
3258
  this.bottomElementHeight = isRendered ? (this.totalHeight - this.topElementHeight) : this.totalHeight;
3257
- this.listDiff = isRendered ? this.listDiff : 0;
3259
+ this.listDiff = isRendered && Object.keys(curViewDS).length !== this.domItemCount ? this.listDiff : 0;
3258
3260
  if (isRendered) {
3259
3261
  this.listViewInstance.element.scrollTop = this.listViewInstance.previousScrollTop;
3260
3262
  }