syncWithModel relationship param

This commit is contained in:
Yuri Kuznetsov
2023-12-29 15:51:05 +02:00
parent 7f34ebc1d7
commit 102921b826
2 changed files with 22 additions and 0 deletions
@@ -290,6 +290,24 @@ class RelationshipPanelView extends BottomPanelView {
this.listenTo(this.model, 'update-all', () => collection.fetch());
if (this.defs.syncWithModel) {
this.listenTo(this.model, 'sync', (m, a, o) => {
if (!o.patch && !o.highlight) {
// Skip if not save and not web-socket update.
return;
}
if (
this.collection.lastSyncPromise &&
this.collection.lastSyncPromise.getReadyState() < 4
) {
return;
}
this.collection.fetch();
});
}
const viewName =
this.defs.recordListView ||
this.getMetadata().get(['clientDefs', this.entityType, 'recordViews', 'listRelated']) ||
+4
View File
@@ -467,6 +467,10 @@
"selectLayout": {
"type": "string",
"description": "A list layout name for the select dialog."
},
"syncWithModel": {
"type": "boolean",
"description": "Re-fetch records when the parent model is saved."
}
}
}