@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.
@@ -2561,13 +2561,10 @@ class DataManipulation {
2561
2561
  // }
2562
2562
  selfReferenceUpdate(selfData) {
2563
2563
  const result = [];
2564
- while (this.hierarchyData.length > 0 && selfData.length > 0) {
2565
- const index = selfData.indexOf(this.hierarchyData[0]);
2566
- if (index === -1) {
2567
- this.hierarchyData.shift();
2568
- }
2569
- else {
2570
- result.push(this.hierarchyData.shift());
2564
+ for (let i = 0; i < this.hierarchyData.length && selfData.length > 0; i++) {
2565
+ const index = selfData.indexOf(this.hierarchyData[parseInt(i.toString(), 10)]);
2566
+ if (index !== -1) {
2567
+ result.push(this.hierarchyData[parseInt(i.toString(), 10)]);
2571
2568
  selfData.splice(index, 1);
2572
2569
  }
2573
2570
  }
@@ -8221,10 +8218,25 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
8221
8218
  this.grid.on('initial-end', this.afterGridRender, this);
8222
8219
  this.grid.on('partial-filter-update', this.partialFilterUpdate, this);
8223
8220
  this.grid.on('get-row-cells', this.getCellsByTableName, this);
8221
+ this.grid.on('save-complete', this.onSaveComplete, this);
8224
8222
  }
8225
8223
  updateResultModel(returnResult) {
8226
8224
  this.dataResults = returnResult;
8227
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
+ }
8228
8240
  /**
8229
8241
  * @hidden
8230
8242
  * @returns {void}
@@ -8238,6 +8250,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
8238
8250
  this.grid.off('last-rowcell-border-updated', this.lastRowCellBorderUpdated);
8239
8251
  this.grid.off('partial-filter-update', this.partialFilterUpdate);
8240
8252
  this.grid.off('get-row-cells', this.getCellsByTableName);
8253
+ this.grid.off('save-complete', this.onSaveComplete);
8241
8254
  }
8242
8255
  getCellsByTableName(args) {
8243
8256
  if (!Array.isArray(args.elements)) {
@@ -15478,7 +15491,8 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
15478
15491
  let index = scrolledRows + visibleRows - this.parent.pageSettings.pageSize;
15479
15492
  index = (index > 0) ? index : 0;
15480
15493
  if (!isNullOrUndefined(this[`${selectedRowIndex}`]) && this[`${selectedRowIndex}`] !== -1 && index !== this[`${selectedRowIndex}`] &&
15481
- ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop) && !this.parent.allowRowDragAndDrop) {
15494
+ (this.parent.rowHeight && ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop)) &&
15495
+ !this.parent.allowRowDragAndDrop) {
15482
15496
  index = this[`${selectedRowIndex}`];
15483
15497
  }
15484
15498
  this.startIndex = index;