@syncfusion/ej2-treegrid 33.2.8 → 33.2.12

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.
@@ -8218,10 +8218,25 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
8218
8218
  this.grid.on('initial-end', this.afterGridRender, this);
8219
8219
  this.grid.on('partial-filter-update', this.partialFilterUpdate, this);
8220
8220
  this.grid.on('get-row-cells', this.getCellsByTableName, this);
8221
+ this.grid.on('save-complete', this.onSaveComplete, this);
8221
8222
  }
8222
8223
  updateResultModel(returnResult) {
8223
8224
  this.dataResults = returnResult;
8224
8225
  }
8226
+ onSaveComplete(args) {
8227
+ if (!this['isGantt'] && this.enableVirtualization && args.action === 'add'
8228
+ && (!isNullOrUndefined(args.index) && args.index !== -1) && args.data) {
8229
+ const primaryKeyField = this.getPrimaryKeyFieldNames()[0];
8230
+ const dataRecord = args.data;
8231
+ const addedRecordValue = Object.prototype.hasOwnProperty.call(dataRecord, primaryKeyField)
8232
+ ? dataRecord[`${primaryKeyField}`]
8233
+ : undefined;
8234
+ if (!isNullOrUndefined(addedRecordValue)) {
8235
+ const index = this.grid.getRowIndexByPrimaryKey(addedRecordValue);
8236
+ args.index = index !== -1 ? index : args.index;
8237
+ }
8238
+ }
8239
+ }
8225
8240
  /**
8226
8241
  * @hidden
8227
8242
  * @returns {void}
@@ -8235,6 +8250,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
8235
8250
  this.grid.off('last-rowcell-border-updated', this.lastRowCellBorderUpdated);
8236
8251
  this.grid.off('partial-filter-update', this.partialFilterUpdate);
8237
8252
  this.grid.off('get-row-cells', this.getCellsByTableName);
8253
+ this.grid.off('save-complete', this.onSaveComplete);
8238
8254
  }
8239
8255
  getCellsByTableName(args) {
8240
8256
  if (!Array.isArray(args.elements)) {
@@ -15453,6 +15469,10 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
15453
15469
  this.parent.root.scrollPosition = scrollArgs.offset;
15454
15470
  }
15455
15471
  const info = scrollArgs.sentinel;
15472
+ let treeGridParent = null;
15473
+ if (this.parent.clipboardModule && this.parent.clipboardModule['treeGridParent']) {
15474
+ treeGridParent = this.parent.clipboardModule['treeGridParent'];
15475
+ }
15456
15476
  const rowHeight = parseInt(this.parent.getRowHeight().toString(), 10);
15457
15477
  const outBuffer = this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 2);
15458
15478
  let content;
@@ -15530,7 +15550,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
15530
15550
  else if (downScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left') && !isNullOrUndefined(content)) {
15531
15551
  let nextSetResIndex = ~~(content.scrollTop / rowHeight);
15532
15552
  const isLastBlock = (this[`${selectedRowIndex}`] + this.parent.pageSettings.pageSize) < this.totalRecords ? false : true;
15533
- if (!isNullOrUndefined(this[`${selectedRowIndex}`]) && this[`${selectedRowIndex}`] !== -1 &&
15553
+ if (treeGridParent !== null && treeGridParent.isGantt && !isNullOrUndefined(this[`${selectedRowIndex}`]) && this[`${selectedRowIndex}`] !== -1 &&
15534
15554
  nextSetResIndex !== this[`${selectedRowIndex}`] && !isLastBlock && !this.parent.allowRowDragAndDrop) {
15535
15555
  nextSetResIndex = this[`${selectedRowIndex}`];
15536
15556
  }
@@ -15641,6 +15661,15 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
15641
15661
  * @returns {void}
15642
15662
  */
15643
15663
  appendContent(target, newChild, e) {
15664
+ let treeGridParent = null;
15665
+ if (this.parent.clipboardModule && this.parent.clipboardModule['treeGridParent']) {
15666
+ treeGridParent = this.parent.clipboardModule['treeGridParent'];
15667
+ }
15668
+ const totalBlocks = this.getTotalBlocks();
15669
+ const lastPage = Math.ceil(totalBlocks / 2);
15670
+ const isBottom = (this.parent.pageSettings.currentPage === lastPage) &&
15671
+ (treeGridParent && treeGridParent.flatData &&
15672
+ treeGridParent.flatData.length === e.index + 1);
15644
15673
  if ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
15645
15674
  && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent)
15646
15675
  || (this.parent.isFrozenGrid() && (e.requestType === undefined || !isNullOrUndefined(e.virtualInfo) && (e.virtualInfo.direction === 'right' || e.virtualInfo.direction === 'left')))) {
@@ -15725,6 +15754,14 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
15725
15754
  }
15726
15755
  }
15727
15756
  }
15757
+ if ((treeGridParent !== null && !treeGridParent.isGantt) && e.action === 'add' && isBottom) {
15758
+ const rowHeight = this.parent.getRowHeight();
15759
+ const pageSize = this.parent.pageSettings.pageSize;
15760
+ const newTranslateY = (this.totalRecords * rowHeight) - (pageSize * rowHeight);
15761
+ this.translateY = newTranslateY > 0 ? newTranslateY : this.translateY;
15762
+ this.virtualEle.adjustTable(cOffset, this.translateY);
15763
+ this.content.scrollTop = this.translateY;
15764
+ }
15728
15765
  this.restoreEditState();
15729
15766
  super[`${restoreAdd}`]();
15730
15767
  super[`${ensureSelectedRowPosition}`]();