@syncfusion/ej2-treegrid 33.2.3 → 33.2.10

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.
@@ -2725,13 +2725,10 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2725
2725
  // }
2726
2726
  DataManipulation.prototype.selfReferenceUpdate = function (selfData) {
2727
2727
  var result = [];
2728
- while (this.hierarchyData.length > 0 && selfData.length > 0) {
2729
- var index = selfData.indexOf(this.hierarchyData[0]);
2730
- if (index === -1) {
2731
- this.hierarchyData.shift();
2732
- }
2733
- else {
2734
- result.push(this.hierarchyData.shift());
2728
+ for (var i = 0; i < this.hierarchyData.length && selfData.length > 0; i++) {
2729
+ var index = selfData.indexOf(this.hierarchyData[parseInt(i.toString(), 10)]);
2730
+ if (index !== -1) {
2731
+ result.push(this.hierarchyData[parseInt(i.toString(), 10)]);
2735
2732
  selfData.splice(index, 1);
2736
2733
  }
2737
2734
  }
@@ -8590,10 +8587,25 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
8590
8587
  this.grid.on('initial-end', this.afterGridRender, this);
8591
8588
  this.grid.on('partial-filter-update', this.partialFilterUpdate, this);
8592
8589
  this.grid.on('get-row-cells', this.getCellsByTableName, this);
8590
+ this.grid.on('save-complete', this.onSaveComplete, this);
8593
8591
  };
8594
8592
  TreeGrid.prototype.updateResultModel = function (returnResult) {
8595
8593
  this.dataResults = returnResult;
8596
8594
  };
8595
+ TreeGrid.prototype.onSaveComplete = function (args) {
8596
+ if (!this['isGantt'] && this.enableVirtualization && args.action === 'add'
8597
+ && (!isNullOrUndefined(args.index) && args.index !== -1) && args.data) {
8598
+ var primaryKeyField = this.getPrimaryKeyFieldNames()[0];
8599
+ var dataRecord = args.data;
8600
+ var addedRecordValue = Object.prototype.hasOwnProperty.call(dataRecord, primaryKeyField)
8601
+ ? dataRecord["" + primaryKeyField]
8602
+ : undefined;
8603
+ if (!isNullOrUndefined(addedRecordValue)) {
8604
+ var index = this.grid.getRowIndexByPrimaryKey(addedRecordValue);
8605
+ args.index = index !== -1 ? index : args.index;
8606
+ }
8607
+ }
8608
+ };
8597
8609
  /**
8598
8610
  * @hidden
8599
8611
  * @returns {void}
@@ -8607,6 +8619,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
8607
8619
  this.grid.off('last-rowcell-border-updated', this.lastRowCellBorderUpdated);
8608
8620
  this.grid.off('partial-filter-update', this.partialFilterUpdate);
8609
8621
  this.grid.off('get-row-cells', this.getCellsByTableName);
8622
+ this.grid.off('save-complete', this.onSaveComplete);
8610
8623
  };
8611
8624
  TreeGrid.prototype.getCellsByTableName = function (args) {
8612
8625
  if (!Array.isArray(args.elements)) {
@@ -15972,7 +15985,8 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
15972
15985
  var index = scrolledRows + visibleRows - this.parent.pageSettings.pageSize;
15973
15986
  index = (index > 0) ? index : 0;
15974
15987
  if (!isNullOrUndefined(this["" + selectedRowIndex]) && this["" + selectedRowIndex] !== -1 && index !== this["" + selectedRowIndex] &&
15975
- ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop) && !this.parent.allowRowDragAndDrop) {
15988
+ (this.parent.rowHeight && ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop)) &&
15989
+ !this.parent.allowRowDragAndDrop) {
15976
15990
  index = this["" + selectedRowIndex];
15977
15991
  }
15978
15992
  this.startIndex = index;