mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +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 { Attribute } from "../../../services/attribute_parser.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";
|
||||
|
||||
const TPL = /*html*/`
|
||||
@ -86,20 +86,17 @@ export default class TableView extends ViewMode<StateInfo> {
|
||||
Tabulator.registerModule(module);
|
||||
}
|
||||
|
||||
this.api = new Tabulator(el, {});
|
||||
this.loadData();
|
||||
}
|
||||
|
||||
private async loadData() {
|
||||
if (!this.api) {
|
||||
return;
|
||||
this.initialize(el);
|
||||
}
|
||||
|
||||
private async initialize(el: HTMLElement) {
|
||||
const notes = await froca.getNotes(this.args.noteIds);
|
||||
const info = getPromotedAttributeInformation(this.parentNote);
|
||||
|
||||
this.api.setColumns(buildColumnDefinitions(info));
|
||||
this.api.setData(await buildRowDefinitions(this.parentNote, notes, info));
|
||||
this.api = new Tabulator(el, {
|
||||
columns: buildColumnDefinitions(info),
|
||||
data: await buildRowDefinitions(this.parentNote, notes, info)
|
||||
});
|
||||
}
|
||||
|
||||
private onSave() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user