diff --git a/apps/client/src/widgets/view_widgets/table_view/data.ts b/apps/client/src/widgets/view_widgets/table_view/data.ts index a86886f70..4dd8c7b12 100644 --- a/apps/client/src/widgets/view_widgets/table_view/data.ts +++ b/apps/client/src/widgets/view_widgets/table_view/data.ts @@ -2,7 +2,7 @@ import FNote from "../../../entities/fnote.js"; import type { LabelType } from "../../../services/promoted_attribute_definition_parser.js"; import type { ColumnDefinition } from "tabulator-tables"; import link from "../../../services/link.js"; -import RelationEditor from "./relation_editor.js"; +import { RelationEditor, RelationFormatter } from "./relation_editor.js"; export type TableData = { iconClass: string; @@ -46,7 +46,8 @@ const labelTypeMappings: Record> = { editor: "input" }, relation: { - editor: RelationEditor + editor: RelationEditor, + formatter: RelationFormatter } }; diff --git a/apps/client/src/widgets/view_widgets/table_view/relation_editor.ts b/apps/client/src/widgets/view_widgets/table_view/relation_editor.ts index 34efad4f6..5b463afd1 100644 --- a/apps/client/src/widgets/view_widgets/table_view/relation_editor.ts +++ b/apps/client/src/widgets/view_widgets/table_view/relation_editor.ts @@ -1,7 +1,7 @@ import { CellComponent } from "tabulator-tables"; import note_autocomplete from "../../../services/note_autocomplete"; -export default function RelationEditor(cell: CellComponent, onRendered, success, cancel, editorParams){ +export function RelationEditor(cell: CellComponent, onRendered, success, cancel, editorParams){ //cell - the cell component for the editable cell //onRendered - function to call when the editor has been rendered //success - function to call to pass thesuccessfully updated value to Tabulator @@ -38,3 +38,12 @@ export default function RelationEditor(cell: CellComponent, onRendered, success, //return the editor element return editor; }; + +export function RelationFormatter(cell: CellComponent, formatterParams, onRendered) { + const noteId = cell.getValue(); + if (!noteId) { + return ""; + } + + return `Title goes here`; +}