@syncfusion/ej2-treegrid 27.2.2 → 27.2.3

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.
@@ -13325,9 +13325,15 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13325
13325
  firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
13326
13326
  }
13327
13327
  if (firsttdinx === 0) {
13328
- this.translateY = !isNullOrUndefined(this.endIndex) ?
13329
- (this.endIndex - this.parent.pageSettings.pageSize) * (this.parent.rowHeight ?
13330
- this.parent.rowHeight : this.parent.getRowHeight()) : 0;
13328
+ if (this.endIndex - this.startIndex < this.parent.pageSettings.pageSize) {
13329
+ this.translateY = !isNullOrUndefined(this.endIndex) ?
13330
+ (this.endIndex - this.parent.pageSettings.pageSize) * (this.parent.rowHeight ?
13331
+ this.parent.rowHeight : this.parent.getRowHeight()) : 0;
13332
+ }
13333
+ else {
13334
+ this.translateY = (scrollArgs.offset.top - (outBuffer * rowHeight) > 0) ?
13335
+ scrollArgs.offset.top - (outBuffer * rowHeight) + rowHeight : 0;
13336
+ }
13331
13337
  }
13332
13338
  else if (this.parent.getFrozenColumns() > 0) {
13333
13339
  scrollArgs.offset.top = scrollArgs.offset.top + 80;
@@ -13361,6 +13367,8 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13361
13367
  ((this.startIndex - currentViewData[0][`${indexValue}`]) < (this.parent.pageSettings.pageSize / 2)) && this.parent.selectionModule.isRowSelected) {
13362
13368
  this.startIndex = currentViewData[0][`${indexValue}`] + (this.parent.pageSettings.pageSize / 2);
13363
13369
  }
13370
+ const selectedIndex = this.parent.root.selectedRowIndex;
13371
+ this.startIndex = selectedIndex !== -1 && selectedIndex !== this.startIndex ? this.startIndex - 1 : this.startIndex;
13364
13372
  if (scrollArgs.offset.top > (rowHeight * this.totalRecords)) {
13365
13373
  this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
13366
13374
  }
@@ -13369,10 +13377,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13369
13377
  this.translateY = (this.totalRecords * rowHeight) - ((this.endIndex - this.startIndex) * rowHeight);
13370
13378
  }
13371
13379
  else {
13372
- if (this.parent.allowRowDragAndDrop) {
13373
- this.translateY = scrollArgs.offset.top - rowHeight * 2;
13374
- }
13375
- else if (this.parent.getFrozenColumns() > 0) {
13380
+ if (this.parent.getFrozenColumns() > 0) {
13376
13381
  this.translateY = scrollArgs.offset.top - ((rowHeight * 2) + this.parent.pageSettings.pageSize);
13377
13382
  }
13378
13383
  else {