@trudb/tru-common-lib 0.2.234 → 0.2.235
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.
|
@@ -7793,6 +7793,9 @@ class TruDataGrid {
|
|
|
7793
7793
|
this.api.refreshCells({ force: true });
|
|
7794
7794
|
}
|
|
7795
7795
|
}));
|
|
7796
|
+
// Listen for entities added elsewhere in the app
|
|
7797
|
+
// Merge this logic with addEntity() logic below
|
|
7798
|
+
// Three ways to add: Directly via toolbar, signalR, or listen for entity added event
|
|
7796
7799
|
this.subs.push(this.dataContext.onEntityAdded().subscribe((changeArgs) => {
|
|
7797
7800
|
if (!changeArgs.entity || this.isActive)
|
|
7798
7801
|
return;
|
|
@@ -7928,7 +7931,12 @@ class TruDataGrid {
|
|
|
7928
7931
|
return false;
|
|
7929
7932
|
};
|
|
7930
7933
|
addEntity = (newEntity, dataNotification = false) => {
|
|
7931
|
-
|
|
7934
|
+
let entityAlreadyInGrid = false;
|
|
7935
|
+
this.api?.forEachNodeAfterFilter((rowNode) => {
|
|
7936
|
+
if (rowNode.data.$entity.Ref === newEntity.Ref)
|
|
7937
|
+
entityAlreadyInGrid = true;
|
|
7938
|
+
});
|
|
7939
|
+
if (this.entity && dataNotification || entityAlreadyInGrid)
|
|
7932
7940
|
return;
|
|
7933
7941
|
if (this.entity) {
|
|
7934
7942
|
newEntity[this.config.parentTableRelationshipRefName] = this.entity[this.config.parentTableRefName];
|