@trudb/tru-common-lib 0.2.360 → 0.2.361
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.
|
@@ -7743,7 +7743,7 @@ class TruDataGrid {
|
|
|
7743
7743
|
setNoRowsTemplate = () => {
|
|
7744
7744
|
//this.noRowsTemplate = `<span style="font-size:14px;font-weight:bold;">No data found.</span>`;
|
|
7745
7745
|
};
|
|
7746
|
-
|
|
7746
|
+
applyRelationshipsAndUpdateGrid = (newEntity) => {
|
|
7747
7747
|
if (this.entity) {
|
|
7748
7748
|
newEntity[this.config.parentTableRelationshipRefName] = this.entity[this.config.parentTableRefName];
|
|
7749
7749
|
}
|
|
@@ -7751,7 +7751,7 @@ class TruDataGrid {
|
|
|
7751
7751
|
//let parentName = this.entity.constructor.name;
|
|
7752
7752
|
let unassociatedType = this.config.resultConfig.entityManyToManyType;
|
|
7753
7753
|
let ref = this.selectedUnassociatedChoice.value.$;
|
|
7754
|
-
|
|
7754
|
+
this.dataContext.entityAccess().searchByRefServerOnly(unassociatedType, ref).subscribe((childToAssociate) => {
|
|
7755
7755
|
if (!childToAssociate)
|
|
7756
7756
|
childToAssociate = this.appEnvironment.globalDataContext?.entityAccess().searchByRefCacheOnly(unassociatedType, ref, true);
|
|
7757
7757
|
if (childToAssociate) {
|
|
@@ -7767,9 +7767,17 @@ class TruDataGrid {
|
|
|
7767
7767
|
this.selectedUnassociatedChoice = undefined;
|
|
7768
7768
|
// add row to grid
|
|
7769
7769
|
this.unsavedEntities.push(enhancedEntity);
|
|
7770
|
+
this.rowData.push(newEntity);
|
|
7771
|
+
this.api.applyTransaction({ add: [newEntity], addIndex: 0 });
|
|
7772
|
+
this.api.refreshCells({ force: true });
|
|
7770
7773
|
}
|
|
7771
7774
|
});
|
|
7772
7775
|
}
|
|
7776
|
+
else {
|
|
7777
|
+
this.rowData.push(newEntity);
|
|
7778
|
+
this.api.applyTransaction({ add: [newEntity], addIndex: 0 });
|
|
7779
|
+
this.api.refreshCells({ force: true });
|
|
7780
|
+
}
|
|
7773
7781
|
};
|
|
7774
7782
|
subscribeTo = () => {
|
|
7775
7783
|
this.subs.push(this.appEnvironment.onSaveComplete$.pipe(skip(1)).subscribe(event => {
|
|
@@ -7986,10 +7994,7 @@ class TruDataGrid {
|
|
|
7986
7994
|
});
|
|
7987
7995
|
if (newEntity.Ref < 0 && !entityAlreadyInGrid) {
|
|
7988
7996
|
let enhancedEntity = this.enhanceRowDataForEntity(newEntity);
|
|
7989
|
-
this.
|
|
7990
|
-
this.rowData.push(enhancedEntity);
|
|
7991
|
-
this.api.applyTransaction({ add: [enhancedEntity], addIndex: 0 });
|
|
7992
|
-
this.api.refreshCells({ force: true });
|
|
7997
|
+
this.applyRelationshipsAndUpdateGrid(enhancedEntity);
|
|
7993
7998
|
}
|
|
7994
7999
|
else {
|
|
7995
8000
|
let results;
|