@trudb/tru-common-lib 0.2.215 → 0.2.217

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.
@@ -7761,20 +7761,31 @@ class TruDataGrid {
7761
7761
  }));
7762
7762
  }
7763
7763
  this.subs.push(this.connectionHub.subscribe(this.dataContext, this.config.resultConfig.entityType, this.config.resultConfig.entityType.name, this.addEntity, this.getRowData, () => { return this.latestSetupQuery; }, this.config.resultConfig.expands, [], () => { return true; }).subscribe((dataChange) => {
7764
- let rowNodesToDelete = [];
7764
+ let rowNodesToRemove = [];
7765
+ let rowNodesToAdd = [];
7765
7766
  dataChange.dataChanges.forEach((change) => {
7766
7767
  if (change.changeOperation === 'D') {
7767
7768
  this.api.forEachNode(function (rowNode) {
7768
7769
  if (rowNode.data.$entity.Ref === change.tableRef) {
7769
- rowNodesToDelete.push(rowNode);
7770
+ rowNodesToRemove.push(rowNode.data);
7770
7771
  }
7771
7772
  });
7772
7773
  }
7773
7774
  else if (change.changeOperation === 'I') {
7775
+ let entity;
7776
+ if (this.gridType === TruDataGridTypes.DetailManyToMany)
7777
+ entity = this.dataContext.entityAccess().searchByRefCacheOnly(this.config.resultConfig.entityManyToManyType, change.tableRef, true);
7778
+ else
7779
+ entity = this.dataContext.entityAccess().searchByRefCacheOnly(this.config.resultConfig.entityType, change.tableRef, true);
7780
+ if (entity) {
7781
+ rowNodesToAdd.push(this.enhanceRowDataForEntity(entity));
7782
+ }
7774
7783
  }
7775
7784
  });
7776
- if (rowNodesToDelete.length)
7777
- this.api.applyTransaction({ remove: rowNodesToDelete });
7785
+ if (rowNodesToRemove.length)
7786
+ this.api.applyTransaction({ remove: rowNodesToRemove });
7787
+ if (rowNodesToAdd.length)
7788
+ this.api.applyTransaction({ add: rowNodesToRemove });
7778
7789
  this.api.refreshCells({ force: true });
7779
7790
  }));
7780
7791
  this.subs.push(fromEvent(document, 'keydown').subscribe((event) => {