@trudb/tru-common-lib 0.2.330 → 0.2.331
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.
|
@@ -7964,25 +7964,26 @@ class TruDataGrid {
|
|
|
7964
7964
|
return false;
|
|
7965
7965
|
};
|
|
7966
7966
|
addEntity = (newEntity) => {
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
}
|
|
7985
|
-
|
|
7967
|
+
if (newEntity.Ref < 0) {
|
|
7968
|
+
let enhancedEntity = this.enhanceRowDataForEntity(newEntity);
|
|
7969
|
+
this.applyRelationships(newEntity);
|
|
7970
|
+
this.rowData.push(enhancedEntity);
|
|
7971
|
+
this.api.applyTransaction({ add: [enhancedEntity], addIndex: 0 });
|
|
7972
|
+
}
|
|
7973
|
+
else {
|
|
7974
|
+
let results;
|
|
7975
|
+
if (this.gridType === TruDataGridTypes.DetailManyToMany)
|
|
7976
|
+
results = this.dataContext.entityAccess().searchByRefArrayCacheOnly(this.config.resultConfig.entityManyToManyType, this.latestSetupQuery, [newEntity.Ref]);
|
|
7977
|
+
else
|
|
7978
|
+
results = this.dataContext.entityAccess().searchByRefArrayCacheOnly(this.config.resultConfig.entityType, this.latestSetupQuery, [newEntity.Ref]);
|
|
7979
|
+
if (results) {
|
|
7980
|
+
let entityAlreadyInGrid = null;
|
|
7981
|
+
this.api?.forEachNodeAfterFilter((rowNode) => {
|
|
7982
|
+
if (rowNode.data.$entity.Ref === newEntity.Ref)
|
|
7983
|
+
entityAlreadyInGrid = newEntity;
|
|
7984
|
+
});
|
|
7985
|
+
if (!entityAlreadyInGrid) {
|
|
7986
|
+
let enhancedEntity = this.enhanceRowDataForEntity(newEntity);
|
|
7986
7987
|
this.rowData.unshift(enhancedEntity);
|
|
7987
7988
|
this.api.applyTransaction({ add: [enhancedEntity] });
|
|
7988
7989
|
}
|