From 3d2db23f330e424286c70b481a8c411b5725f02e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 28 Jun 2025 17:24:18 +0300 Subject: [PATCH] fix(views/table): use a more stable loading mechanism --- .../widgets/view_widgets/table_view/index.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/apps/client/src/widgets/view_widgets/table_view/index.ts b/apps/client/src/widgets/view_widgets/table_view/index.ts index 017a595cd..b413f60bc 100644 --- a/apps/client/src/widgets/view_widgets/table_view/index.ts +++ b/apps/client/src/widgets/view_widgets/table_view/index.ts @@ -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 { Tabulator.registerModule(module); } - this.api = new Tabulator(el, {}); - this.loadData(); + this.initialize(el); } - private async loadData() { - if (!this.api) { - return; - } - + 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() {