mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
fix(views/table): use a more stable loading mechanism
This commit is contained in:
parent
56d366a286
commit
3d2db23f33
@ -8,7 +8,7 @@ import branches from "../../../services/branches.js";
|
|||||||
import type { CommandListenerData, EventData } from "../../../components/app_context.js";
|
import type { CommandListenerData, EventData } from "../../../components/app_context.js";
|
||||||
import type { Attribute } from "../../../services/attribute_parser.js";
|
import type { Attribute } from "../../../services/attribute_parser.js";
|
||||||
import note_create from "../../../services/note_create.js";
|
import note_create from "../../../services/note_create.js";
|
||||||
import {Tabulator, SortModule, FormatModule} from 'tabulator-tables';
|
import {Tabulator, SortModule, FormatModule, InteractionModule} from 'tabulator-tables';
|
||||||
import "tabulator-tables/dist/css/tabulator_bootstrap5.min.css";
|
import "tabulator-tables/dist/css/tabulator_bootstrap5.min.css";
|
||||||
|
|
||||||
const TPL = /*html*/`
|
const TPL = /*html*/`
|
||||||
@ -86,20 +86,17 @@ export default class TableView extends ViewMode<StateInfo> {
|
|||||||
Tabulator.registerModule(module);
|
Tabulator.registerModule(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.api = new Tabulator(el, {});
|
this.initialize(el);
|
||||||
this.loadData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async loadData() {
|
private async initialize(el: HTMLElement) {
|
||||||
if (!this.api) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const notes = await froca.getNotes(this.args.noteIds);
|
const notes = await froca.getNotes(this.args.noteIds);
|
||||||
const info = getPromotedAttributeInformation(this.parentNote);
|
const info = getPromotedAttributeInformation(this.parentNote);
|
||||||
|
|
||||||
this.api.setColumns(buildColumnDefinitions(info));
|
this.api = new Tabulator(el, {
|
||||||
this.api.setData(await buildRowDefinitions(this.parentNote, notes, info));
|
columns: buildColumnDefinitions(info),
|
||||||
|
data: await buildRowDefinitions(this.parentNote, notes, info)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private onSave() {
|
private onSave() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user