@syncfusion/ej2-treegrid 26.2.8 → 26.2.9

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.
@@ -4569,6 +4569,16 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4569
4569
  this.grid.selectionModule[`${updateRowSelection}`](this.getRows()[parseInt(index.toString(), 10)], index);
4570
4570
  }
4571
4571
  }
4572
+ if (this.enableVirtualization && this.selectionSettings.persistSelection
4573
+ && !isNullOrUndefined(this.virtualScrollModule.prevSelectedRecord)) {
4574
+ for (let i = 0; i < this.virtualScrollModule.prevSelectedRecord.length; i++) {
4575
+ const updateRowSelection = 'updateRowSelection';
4576
+ const index =
4577
+ // eslint-disable-next-line max-len
4578
+ this.getCurrentViewRecords().indexOf(this.virtualScrollModule.prevSelectedRecord[parseInt(i.toString(), 10)]);
4579
+ this.grid.selectionModule[`${updateRowSelection}`](this.getRows()[parseInt(index.toString(), 10)], index);
4580
+ }
4581
+ }
4572
4582
  this.trigger(dataBound, args);
4573
4583
  this.initialRender = false;
4574
4584
  };
@@ -6355,22 +6365,13 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6355
6365
  expandArgs = { data: parentRec, row: row };
6356
6366
  this.trigger(expanded, expandArgs);
6357
6367
  }
6368
+ else if (!this.isExpandAll && this.enableVirtualization && this.selectionSettings.persistSelection
6369
+ && !isNullOrUndefined(this.virtualScrollModule.prevSelectedRecord)) {
6370
+ this.virtualScrollModule.prevSelectedRecord = [];
6371
+ }
6358
6372
  else if (!this.isExpandAll) {
6359
6373
  this.trigger(expanded, expandArgs);
6360
6374
  }
6361
- if (record.expanded && this.enableVirtualization && this.selectionSettings.persistSelection
6362
- && !isNullOrUndefined(this.virtualScrollModule.prevSelectedRecord)) {
6363
- for (let i = 0; i < this.virtualScrollModule.prevSelectedRecord.length; i++) {
6364
- if (record.uniqueID ===
6365
- this.virtualScrollModule.prevSelectedRecord[parseInt(i.toString(), 10)].parentItem.uniqueID) {
6366
- const updateRowSelection = 'updateRowSelection';
6367
- const index =
6368
- // eslint-disable-next-line max-len
6369
- this.getCurrentViewRecords().indexOf(this.virtualScrollModule.prevSelectedRecord[parseInt(i.toString(), 10)]);
6370
- this.grid.selectionModule[`${updateRowSelection}`](this.getRows()[parseInt(index.toString(), 10)], index);
6371
- }
6372
- }
6373
- }
6374
6375
  }
6375
6376
  }
6376
6377
  expandCollapseAllChildren(record, action, key, level) {
@@ -8812,7 +8813,7 @@ class RowDD {
8812
8813
  this.canDrop = false;
8813
8814
  this.addErrorElem();
8814
8815
  }
8815
- if (!tObj.rowDropSettings.targetID && this.canDrop) {
8816
+ if (!tObj.rowDropSettings.targetID && this.canDrop && !isNullOrUndefined(args.rows[0])) {
8816
8817
  tObj.rowDragAndDropModule.updateIcon(args.rows, rowIdx, args);
8817
8818
  }
8818
8819
  if (isNullOrUndefined(tObj.rowDropSettings.targetID) && !this.canDrop) {
@@ -13251,14 +13252,17 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13251
13252
  const info = scrollArgs.sentinel;
13252
13253
  const rowHeight = this.parent.getRowHeight();
13253
13254
  const outBuffer = this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 2);
13254
- const content = this.parent.getContent().querySelector('.e-content');
13255
+ let content;
13256
+ if (!isNullOrUndefined(this.parent.contentModule)) {
13257
+ content = this.parent.getContent().querySelector('.e-content');
13258
+ }
13255
13259
  const scrollHeight = outBuffer * rowHeight;
13256
13260
  const upScroll = (scrollArgs.offset.top - this.translateY) <= 0;
13257
13261
  const downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) + rowHeight >= scrollHeight;
13258
13262
  const selectedRowIndex = 'selectedRowIndex';
13259
13263
  const currentViewData = this.parent.currentViewData;
13260
13264
  const indexValue = 'index';
13261
- if (upScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left')) {
13265
+ if (upScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left') && !isNullOrUndefined(content)) {
13262
13266
  const vHeight = +(this.parent.height.toString().indexOf('%') < 0 ? parseInt(this.parent.height.toString(), 10) :
13263
13267
  this.parent.element.getBoundingClientRect().height);
13264
13268
  let index = (~~(content.scrollTop / rowHeight)
@@ -13306,7 +13310,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13306
13310
  scrollArgs.offset.top - (outBuffer * rowHeight) + 10 : 0;
13307
13311
  }
13308
13312
  }
13309
- else if (downScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left')) {
13313
+ else if (downScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left') && !isNullOrUndefined(content)) {
13310
13314
  let nextSetResIndex = ~~(content.scrollTop / rowHeight);
13311
13315
  const isLastBlock = (this[`${selectedRowIndex}`] + this.parent.pageSettings.pageSize) < this.totalRecords ? false : true;
13312
13316
  if (!isNullOrUndefined(this[`${selectedRowIndex}`]) && this[`${selectedRowIndex}`] !== -1 &&
@@ -13567,6 +13571,7 @@ class VirtualScroll {
13567
13571
  constructor(parent) {
13568
13572
  this.prevstartIndex = -1;
13569
13573
  this.prevendIndex = -1;
13574
+ this.prevSelectedRecord = [];
13570
13575
  this.parent = parent;
13571
13576
  Grid.Inject(TreeVirtual);
13572
13577
  this.addEventListener();
@@ -13696,7 +13701,8 @@ class VirtualScroll {
13696
13701
  }
13697
13702
  }
13698
13703
  //}
13699
- if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll' && !isNullOrUndefined(this.parent.idMapping)) {
13704
+ if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll'
13705
+ && !isNullOrUndefined(this.parent.idMapping) && startIndex === 0) {
13700
13706
  startIndex = 0;
13701
13707
  endIndex = this.parent.grid.pageSettings.pageSize - 1;
13702
13708
  this.parent.grid.notify(virtualActionArgs, { setTop: true });