mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
fix(views/table): error when adding a new column
This commit is contained in:
parent
ada39cd3c7
commit
50ebcd552c
@ -201,7 +201,7 @@ export default class TableView extends ViewMode<StateInfo> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async onEntitiesReloaded({ loadResults }: EventData<"entitiesReloaded">): boolean | void {
|
onEntitiesReloaded({ loadResults }: EventData<"entitiesReloaded">): boolean | void {
|
||||||
if (!this.api) {
|
if (!this.api) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -211,19 +211,27 @@ export default class TableView extends ViewMode<StateInfo> {
|
|||||||
attr.type === "label" &&
|
attr.type === "label" &&
|
||||||
attr.name?.startsWith("label:") &&
|
attr.name?.startsWith("label:") &&
|
||||||
attributes.isAffecting(attr, this.parentNote))) {
|
attributes.isAffecting(attr, this.parentNote))) {
|
||||||
const info = getPromotedAttributeInformation(this.parentNote);
|
this.#manageColumnUpdate();
|
||||||
const columnDefs = buildColumnDefinitions(info);
|
|
||||||
this.api.setColumns(columnDefs)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loadResults.getBranchRows().some(branch => branch.parentNoteId === this.parentNote.noteId)) {
|
if (loadResults.getBranchRows().some(branch => branch.parentNoteId === this.parentNote.noteId)) {
|
||||||
const notes = await froca.getNotes(this.args.noteIds);
|
this.#manageRowsUpdate();
|
||||||
const info = getPromotedAttributeInformation(this.parentNote);
|
|
||||||
this.api.setData(await buildRowDefinitions(this.parentNote, notes, info));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#manageColumnUpdate() {
|
||||||
|
const info = getPromotedAttributeInformation(this.parentNote);
|
||||||
|
const columnDefs = buildColumnDefinitions(info);
|
||||||
|
this.api.setColumns(columnDefs);
|
||||||
|
}
|
||||||
|
|
||||||
|
async #manageRowsUpdate() {
|
||||||
|
const notes = await froca.getNotes(this.args.noteIds);
|
||||||
|
const info = getPromotedAttributeInformation(this.parentNote);
|
||||||
|
this.api.setData(await buildRowDefinitions(this.parentNote, notes, info));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user