Skip to content

Build your personal knowledge base with Trilium Notes

feat(table): offer no editing on a read-only table, nor load it

Elian Doranf8054630bd31
diff --git a/apps/client/src/widgets/collections/table/col_editing.ts b/apps/client/src/widgets/collections/table/col_editing.ts
index dbbd106894..86330b408b 100644
--- a/apps/client/src/widgets/collections/table/col_editing.ts
+++ b/apps/client/src/widgets/collections/table/col_editing.ts
@@ -12,11 +12,15 @@ import dialog from "../../../services/dialog";
import { t } from "i18next";
import { executeBulkActions } from "../../../services/bulk_action";
-export default function useColTableEditing(api: RefObject<Tabulator | null>, attributeDetailWidget: AttributeDetailWidget, parentNote: FNote) {
+export default function useColTableEditing(
+ api: RefObject<Tabulator | null>,
+ attributeDetailWidget: AttributeDetailWidget,
+ parentNote: FNote,
+ newAttributePosition: RefObject<number | undefined>
+) {
const existingAttributeToEdit = useRef<Attribute | undefined>(undefined);
const newAttribute = useRef<Attribute | undefined>(undefined);
- const newAttributePosition = useRef<number | undefined>(undefined);
useLegacyImperativeHandlers({
addNewTableColumnCommand({ referenceColumn, columnToEdit, direction, type }: EventData<"addNewTableColumn">) {
@@ -113,7 +117,7 @@ export default function useColTableEditing(api: RefObject<Tabulator | null>, att
existingAttributeToEdit.current = undefined;
}
- return { newAttributePosition, resetNewAttributePosition };
+ return { resetNewAttributePosition };
}
async function deleteColumn(parentNoteId: string, type: "label" | "relation", columnName: string) {
diff --git a/apps/client/src/widgets/collections/table/context_menu.ts b/apps/client/src/widgets/collections/table/context_menu.ts
index ce0b8e82c0..1752898c13 100644
--- a/apps/client/src/widgets/collections/table/context_menu.ts
+++ b/apps/client/src/widgets/collections/table/context_menu.ts
@@ -11,20 +11,21 @@ import Component from "../../../components/component.js";
import NoteColorPicker from "../../../menus/custom-items/NoteColorPicker.jsx";
import { RefObject } from "preact";
-export function useContextMenu(parentNote: FNote, parentComponent: Component | null | undefined, tabulator: RefObject<Tabulator | null>): Partial<EventCallBackMethods> {
+/** The table's context menus; a read-only table offers only what leaves the notes as they are. */
+export function useContextMenu(parentNote: FNote, parentComponent: Component | null | undefined, tabulator: RefObject<Tabulator | null>, isReadOnly = false): Partial<EventCallBackMethods> {
const events: Partial<EventCallBackMethods> = {};
if (!tabulator || !parentComponent) return events;
- events["rowContext"] = (e, row) => tabulator.current && showRowContextMenu(parentComponent, e as MouseEvent, row, parentNote, tabulator.current);
- events["headerContext"] = (e, col) => tabulator.current && showColumnContextMenu(parentComponent, e as MouseEvent, col, parentNote, tabulator.current);
+ events["rowContext"] = (e, row) => tabulator.current && showRowContextMenu(parentComponent, e as MouseEvent, row, parentNote, tabulator.current, isReadOnly);
+ events["headerContext"] = (e, col) => tabulator.current && showColumnContextMenu(parentComponent, e as MouseEvent, col, parentNote, tabulator.current, isReadOnly);
events["renderComplete"] = () => {
const headerRow = tabulator.current?.element.querySelector(".tabulator-header-contents");
- headerRow?.addEventListener("contextmenu", (e) => showHeaderContextMenu(parentComponent, e as MouseEvent, tabulator.current!));
+ headerRow?.addEventListener("contextmenu", (e) => showHeaderContextMenu(parentComponent, e as MouseEvent, tabulator.current!, isReadOnly));
}
return events;
}
-function showColumnContextMenu(parentComponent: Component, e: MouseEvent, column: ColumnComponent, parentNote: FNote, tabulator: Tabulator) {
+function showColumnContextMenu(parentComponent: Component, e: MouseEvent, column: ColumnComponent, parentNote: FNote, tabulator: Tabulator, isReadOnly: boolean) {
const { title, field } = column.getDefinition();
const sorters = tabulator.getSorters();
@@ -81,43 +82,7 @@ function showColumnContextMenu(parentComponent: Component, e: MouseEvent, column
uiIcon: "bx bx-columns",
items: buildColumnItems(tabulator)
},
- { kind: "separator" },
- {
- title: t("table_view.add-column-to-the-left"),
- uiIcon: "bx bx-horizontal-left",
- enabled: !column.getDefinition().frozen,
- items: buildInsertSubmenu(parentComponent, column, "before"),
- handler: () => parentComponent?.triggerCommand("addNewTableColumn", {
- referenceColumn: column
- })
- },
- {
- title: t("table_view.add-column-to-the-right"),
- uiIcon: "bx bx-horizontal-right",
- items: buildInsertSubmenu(parentComponent, column, "after"),
- handler: () => parentComponent?.triggerCommand("addNewTableColumn", {
- referenceColumn: column,
- direction: "after"
- })
- },
- { kind: "separator" },
- {
- title: t("table_view.edit-column"),
- uiIcon: "bx bxs-edit-alt",
- enabled: isUserDefinedColumn,
- handler: () => parentComponent?.triggerCommand("addNewTableColumn", {
- referenceColumn: column,
- columnToEdit: column
- })
- },
- {
- title: t("table_view.delete-column"),
- uiIcon: "bx bx-trash",
- enabled: isUserDefinedColumn,
- handler: () => parentComponent?.triggerCommand("deleteTableColumn", {
- columnToDelete: column
- })
- }
+ ...(isReadOnly ? [] : buildColumnEditingItems(parentComponent, column, isUserDefinedColumn))
],
selectMenuItemHandler() {},
x: e.pageX,
@@ -126,11 +91,54 @@ function showColumnContextMenu(parentComponent: Component, e: MouseEvent, column
e.preventDefault();
}
+/** The column menu's entries that add, change or delete a column. */
+function buildColumnEditingItems(parentComponent: Component, column: ColumnComponent, isUserDefinedColumn: boolean): MenuItem<unknown>[] {
+ return [
+ { kind: "separator" },
+ {
+ title: t("table_view.add-column-to-the-left"),
+ uiIcon: "bx bx-horizontal-left",
+ enabled: !column.getDefinition().frozen,
+ items: buildInsertSubmenu(parentComponent, column, "before"),
+ handler: () => parentComponent?.triggerCommand("addNewTableColumn", {
+ referenceColumn: column
+ })
+ },
+ {
+ title: t("table_view.add-column-to-the-right"),
+ uiIcon: "bx bx-horizontal-right",
+ items: buildInsertSubmenu(parentComponent, column, "after"),
+ handler: () => parentComponent?.triggerCommand("addNewTableColumn", {
+ referenceColumn: column,
+ direction: "after"
+ })
+ },
+ { kind: "separator" },
+ {
+ title: t("table_view.edit-column"),
+ uiIcon: "bx bxs-edit-alt",
+ enabled: isUserDefinedColumn,
+ handler: () => parentComponent?.triggerCommand("addNewTableColumn", {
+ referenceColumn: column,
+ columnToEdit: column
+ })
+ },
+ {
+ title: t("table_view.delete-column"),
+ uiIcon: "bx bx-trash",
+ enabled: isUserDefinedColumn,
+ handler: () => parentComponent?.triggerCommand("deleteTableColumn", {
+ columnToDelete: column
+ })
+ }
+ ];
+}
+
/**
* Shows a context menu which has options dedicated to the header area (the part where the columns are, but in the empty space).
* Provides generic options such as toggling columns.
*/
-function showHeaderContextMenu(parentComponent: Component, e: MouseEvent, tabulator: Tabulator) {
+function showHeaderContextMenu(parentComponent: Component, e: MouseEvent, tabulator: Tabulator, isReadOnly: boolean) {
contextMenu.show({
items: [
{
@@ -138,13 +146,15 @@ function showHeaderContextMenu(parentComponent: Component, e: MouseEvent, tabula
uiIcon: "bx bx-columns",
items: buildColumnItems(tabulator)
},
- { kind: "separator" },
- {
- title: t("table_view.new-column"),
- uiIcon: "bx bx-empty",
- enabled: false
- },
- ...buildInsertSubmenu(parentComponent)
+ ...(isReadOnly ? [] : [
+ { kind: "separator" } as const,
+ {
+ title: t("table_view.new-column"),
+ uiIcon: "bx bx-empty",
+ enabled: false
+ },
+ ...buildInsertSubmenu(parentComponent)
+ ])
],
selectMenuItemHandler() {},
x: e.pageX,
@@ -153,7 +163,7 @@ function showHeaderContextMenu(parentComponent: Component, e: MouseEvent, tabula
e.preventDefault();
}
-export function showRowContextMenu(parentComponent: Component, e: MouseEvent, row: RowComponent, parentNote: FNote, tabulator: Tabulator) {
+export function showRowContextMenu(parentComponent: Component, e: MouseEvent, row: RowComponent, parentNote: FNote, tabulator: Tabulator, isReadOnly = false) {
const rowData = row.getData() as TableData;
const sorters = tabulator.getSorters();
@@ -167,7 +177,7 @@ export function showRowContextMenu(parentComponent: Component, e: MouseEvent, ro
}
contextMenu.show({
- items: [
+ items: isReadOnly ? link_context_menu.getItems(e) : [
...link_context_menu.getItems(e),
{ kind: "separator" },
{
diff --git a/apps/client/src/widgets/collections/table/data.spec.tsx b/apps/client/src/widgets/collections/table/data.spec.tsx
index 73594db65f..cf5409a5c4 100644
--- a/apps/client/src/widgets/collections/table/data.spec.tsx
+++ b/apps/client/src/widgets/collections/table/data.spec.tsx
@@ -31,12 +31,12 @@ describe("useData", () => {
});
/** Runs the hook as the table does, under a parent that can hand it a reload. */
- function Probe({ note, noteIds }: { note: FNote; noteIds: string[] }) {
- captured = useData(note, noteIds, undefined, { current: undefined }, resetNewAttributePosition);
+ function Probe({ note, noteIds, isReadOnly }: { note: FNote; noteIds: string[]; isReadOnly?: boolean }) {
+ captured = useData(note, noteIds, undefined, { current: undefined }, resetNewAttributePosition, isReadOnly);
return null;
}
- async function mount(note: FNote, noteIds: string[]) {
+ async function mount(note: FNote, noteIds: string[], isReadOnly?: boolean) {
const parent = {
componentId: "table-cid",
registerHandler: (name: string, callback: (data: unknown) => void) => handlers.set(name, callback),
@@ -44,7 +44,7 @@ describe("useData", () => {
} as unknown as Component;
await act(async () => render(
<ParentComponent.Provider value={parent}>
- <Probe note={note} noteIds={noteIds} />
+ <Probe note={note} noteIds={noteIds} isReadOnly={isReadOnly} />
</ParentComponent.Provider>,
container
));
@@ -100,6 +100,19 @@ describe("useData", () => {
expect(editorParams(undefined as never)).toMatchObject({ options: [ "Todo", "Done" ] });
});
+ it("builds a read-only table's columns without editors and keeps its rows from being dragged", async () => {
+ const { note, noteIds } = collection();
+ await mount(note, noteIds);
+ expect(captured?.columnDefs?.some((column) => column.editor)).toBe(true);
+ expect(captured?.movableRows).toBe(true);
+
+ render(null, container);
+ await mount(note, noteIds, true);
+ expect(captured?.columnDefs?.map((column) => column.field)).toContain("labels.status");
+ expect(captured?.columnDefs?.some((column) => column.editor || column.editorParams)).toBe(false);
+ expect(captured?.movableRows).toBe(false);
+ });
+
it("refreshes only the rows for a row change, leaving the columns be", async () => {
const { note, noteIds } = collection();
await mount(note, noteIds);
diff --git a/apps/client/src/widgets/collections/table/data.tsx b/apps/client/src/widgets/collections/table/data.tsx
index 7d6e93138c..8767e01149 100644
--- a/apps/client/src/widgets/collections/table/data.tsx
+++ b/apps/client/src/widgets/collections/table/data.tsx
@@ -15,7 +15,8 @@ export interface TableConfig {
};
}
-export default function useData(note: FNote, noteIds: string[], viewConfig: TableConfig | undefined, newAttributePosition: RefObject<number | undefined> | undefined, resetNewAttributePosition: () => void) {
+/** `isReadOnly` builds the columns without editors and keeps the rows from being dragged. */
+export default function useData(note: FNote, noteIds: string[], viewConfig: TableConfig | undefined, newAttributePosition: RefObject<number | undefined> | undefined, resetNewAttributePosition: () => void, isReadOnly = false) {
const [ maxDepth ] = useNoteLabelInt(note, "maxNestingDepth");
const [ includeArchived ] = useNoteLabelBoolean(note, "includeArchived");
// Whose writes these are, so that the table can tell a definition it changed itself from one
@@ -52,14 +53,14 @@ export default function useData(note: FNote, noteIds: string[], viewConfig: Tabl
.find((definition) => definition.name === columnName)?.options,
onCreateSelectOption: (columnName, option) => addSelectOption(note, columnName, option, componentId)
});
- setColumnDefs(columnDefs);
+ setColumnDefs(isReadOnly ? columnDefs.map(withoutEditor) : columnDefs);
resetNewAttributePosition();
}
setRowData(rowData);
setHasChildren(hasChildren);
}
- useEffect(() => { refresh() }, [ note, noteIds, maxDepth, movableRows ]);
+ useEffect(() => { refresh() }, [ note, noteIds, maxDepth, movableRows, isReadOnly ]);
useTriliumEvent("entitiesReloaded", ({ loadResults}) => {
if (glob.device === "print") return;
@@ -91,12 +92,16 @@ export default function useData(note: FNote, noteIds: string[], viewConfig: Tabl
// Identify if movable rows.
useEffect(() => {
- setMovableRows(!isSorted && note.type !== "search" && !hasChildren);
- }, [ isSorted, note, hasChildren ]);
+ setMovableRows(!isReadOnly && !isSorted && note.type !== "search" && !hasChildren);
+ }, [ isReadOnly, isSorted, note, hasChildren ]);
return { columnDefs, rowData, movableRows, hasChildren };
}
+function withoutEditor({ editor, editorParams, ...column }: ColumnDefinition): ColumnDefinition {
+ return column;
+}
+
/**
* Adds an option to the definition a select column reads from, for the entry its editor offers on a
* value the column does not list yet. The definition is looked up as the columns themselves are, so
diff --git a/apps/client/src/widgets/collections/table/editing.tsx b/apps/client/src/widgets/collections/table/editing.tsx
new file mode 100644
index 0000000000..1a6d5b7a57
--- /dev/null
+++ b/apps/client/src/widgets/collections/table/editing.tsx
@@ -0,0 +1,51 @@
+import type { RefObject } from "preact";
+import { useEffect, useRef } from "preact/hooks";
+import type { EventCallBackMethods, Tabulator } from "tabulator-tables";
+
+import type FNote from "../../../entities/fnote";
+import AttributeDetailWidget from "../../attribute_widgets/attribute_detail";
+import { useLegacyWidget } from "../../react/hooks";
+import useColTableEditing from "./col_editing";
+import useRowTableEditing from "./row_editing";
+
+/** The editing events {@link TableEditing} hands the table, which binds them to Tabulator. */
+export type TableEditingEvents = Pick<EventCallBackMethods, "cellEdited" | "rowMoved">;
+
+interface TableEditingProps {
+ tabulatorRef: RefObject<Tabulator | null>;
+ note: FNote;
+ /** Where the column being added goes, which the table's columns are built with. */
+ newAttributePosition: RefObject<number | undefined>;
+ /** Takes the function that forgets the column being added, once the columns are built with it. */
+ setResetNewAttributePosition(reset: () => void): void;
+ /** Takes the events that write a cell or a moved row, once. */
+ setEvents(events: TableEditingEvents): void;
+}
+
+/**
+ * What makes a table editable: writing an edited cell or a moved row, creating rows, and adding,
+ * changing and deleting columns through the attribute editor. Loaded on its own, so that a
+ * read-only table never loads it.
+ */
+export default function TableEditing({
+ tabulatorRef, note, newAttributePosition, setResetNewAttributePosition, setEvents
+}: TableEditingProps) {
+ const [ attributeDetailWidgetEl, attributeDetailWidget ] =
+ useLegacyWidget(() => new AttributeDetailWidget().contentSized());
+ const rowEditingEvents = useRowTableEditing(tabulatorRef, attributeDetailWidget, note);
+ const { resetNewAttributePosition } =
+ useColTableEditing(tabulatorRef, attributeDetailWidget, note, newAttributePosition);
+
+ // The events change on every render; the table is handed stable ones that call the latest.
+ const eventsRef = useRef(rowEditingEvents);
+ eventsRef.current = rowEditingEvents;
+ useEffect(() => {
+ setEvents({
+ cellEdited: (cell) => eventsRef.current.cellEdited?.(cell),
+ rowMoved: (row) => eventsRef.current.rowMoved?.(row)
+ });
+ }, [ setEvents ]);
+ useEffect(() => setResetNewAttributePosition(resetNewAttributePosition));
+
+ return attributeDetailWidgetEl;
+}
diff --git a/apps/client/src/widgets/collections/table/index.tsx b/apps/client/src/widgets/collections/table/index.tsx
index d1a185a15f..79b4a4634e 100644
--- a/apps/client/src/widgets/collections/table/index.tsx
+++ b/apps/client/src/widgets/collections/table/index.tsx
@@ -1,24 +1,29 @@
import "./index.css";
import { createPortal } from "preact";
+import { lazy, Suspense } from "preact/compat";
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "preact/hooks";
import { DataTreeModule, EditModule, FormatModule, FrozenColumnsModule, InteractionModule, MoveColumnsModule, MoveRowsModule, Options, PersistenceModule, ResizeColumnsModule, RowComponent,SortModule, Tabulator as VanillaTabulator} from 'tabulator-tables';
import { t } from "../../../services/i18n";
import SpacedUpdate from "../../../services/spaced_update";
-import AttributeDetailWidget from "../../attribute_widgets/attribute_detail";
import CollectionProperties from "../../note_bars/CollectionProperties";
import Button, { ButtonOrActionButton } from "../../react/Button";
-import { useLegacyWidget } from "../../react/hooks";
+import { useEffectiveReadOnly, useNoteContext } from "../../react/hooks";
import { ParentComponent } from "../../react/react_utils";
import { ViewModeProps } from "../interface";
-import useColTableEditing from "./col_editing";
import { useContextMenu } from "./context_menu";
import useData, { TableConfig } from "./data";
-import useRowTableEditing from "./row_editing";
+import type { TableEditingEvents } from "./editing";
import { TableData } from "./rows";
import Tabulator from "./tabulator";
+const TableEditing = lazy(() => import("./editing"));
+
+/** What every table shows with; an editable one adds {@link EDITING_MODULES}. */
+const VIEW_MODULES = [ SortModule, FormatModule, InteractionModule, ResizeColumnsModule, FrozenColumnsModule, PersistenceModule, MoveColumnsModule, DataTreeModule ];
+const EDITING_MODULES = [ ...VIEW_MODULES, EditModule, MoveRowsModule ];
+
export default function TableView({ note, noteIds, viewConfig, saveConfig }: ViewModeProps<TableConfig>) {
const tabulatorRef = useRef<VanillaTabulator>(null);
const parentComponent = useContext(ParentComponent);
@@ -31,12 +36,16 @@ export default function TableView({ note, noteIds, viewConfig, saveConfig }: Vie
// rebuilt over — and the child effect applying the new columns runs before this one measures.
const [ handleColWidth, setHandleColWidth ] = useState(0);
- const [ attributeDetailWidgetEl, attributeDetailWidget ] = useLegacyWidget(() => new AttributeDetailWidget().contentSized());
- const contextMenuEvents = useContextMenu(note, parentComponent, tabulatorRef);
+ const { noteContext } = useNoteContext();
+ const isReadOnly = useEffectiveReadOnly(note, noteContext);
+ const canAddRows = !isReadOnly && note.type !== "search";
+ const contextMenuEvents = useContextMenu(note, parentComponent, tabulatorRef, isReadOnly);
const persistenceProps = usePersistence(viewConfig, saveConfig);
- const rowEditingEvents = useRowTableEditing(tabulatorRef, attributeDetailWidget, note);
- const { newAttributePosition, resetNewAttributePosition } = useColTableEditing(tabulatorRef, attributeDetailWidget, note);
- const { columnDefs, rowData, movableRows, hasChildren } = useData(note, noteIds, viewConfig, newAttributePosition, resetNewAttributePosition);
+ const [ editingEvents, setEditingEvents ] = useState<TableEditingEvents>();
+ const newAttributePosition = useRef<number | undefined>(undefined);
+ const resetNewAttributePosition = useRef<() => void>(() => { newAttributePosition.current = undefined; });
+ const { columnDefs, rowData, movableRows, hasChildren } = useData(
+ note, noteIds, viewConfig, newAttributePosition, () => resetNewAttributePosition.current(), isReadOnly);
const dataTreeProps = useMemo<Options>(() => {
if (!hasChildren) return {};
return {
@@ -64,7 +73,7 @@ export default function TableView({ note, noteIds, viewConfig, saveConfig }: Vie
<div className="table-view">
<CollectionProperties
note={note}
- rightChildren={note.type !== "search" &&
+ rightChildren={canAddRows &&
<>
<ButtonOrActionButton triggerCommand="addNewRow" icon="bx bx-plus" text={t("table_view.new-row")} />
<ButtonOrActionButton triggerCommand="addNewTableColumn" icon="bx bx-carousel" text={t("table_view.new-column")} />
@@ -75,14 +84,16 @@ export default function TableView({ note, noteIds, viewConfig, saveConfig }: Vie
{rowData !== undefined && persistenceProps && (
<>
<Tabulator
+ // Built anew when the note turns editable, as a table takes its modules when built.
+ key={isReadOnly ? "read-only" : "editable"}
tabulatorRef={tabulatorRef}
className="table-view-container"
columns={columnDefs ?? []}
data={rowData}
- modules={[ SortModule, FormatModule, InteractionModule, EditModule, ResizeColumnsModule, FrozenColumnsModule, PersistenceModule, MoveColumnsModule, MoveRowsModule, DataTreeModule ]}
+ modules={isReadOnly ? VIEW_MODULES : EDITING_MODULES}
events={{
...contextMenuEvents,
- ...rowEditingEvents
+ ...(isReadOnly ? {} : editingEvents)
}}
persistence {...persistenceProps}
layout="fitDataFill"
@@ -95,7 +106,7 @@ export default function TableView({ note, noteIds, viewConfig, saveConfig }: Vie
)}
{...dataTreeProps}
/>
- {note.type !== "search" && rowsHolderEl && createPortal(
+ {canAddRows && rowsHolderEl && createPortal(
<div
className="table-new-row-strip"
style={{ "--row-handle-column-width": `${handleColWidth}px` }}
@@ -112,7 +123,17 @@ export default function TableView({ note, noteIds, viewConfig, saveConfig }: Vie
)}
</>
)}
- {attributeDetailWidgetEl}
+ {!isReadOnly && (
+ <Suspense fallback={null}>
+ <TableEditing
+ tabulatorRef={tabulatorRef}
+ note={note}
+ newAttributePosition={newAttributePosition}
+ setResetNewAttributePosition={(reset) => { resetNewAttributePosition.current = reset; }}
+ setEvents={setEditingEvents}
+ />
+ </Suspense>
+ )}
</div>
);
}
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Table.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Table.html
index 719c5e94ed..94fe935dfd 100644
--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Table.html
+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Table.html
@@ -112,6 +112,12 @@
<p>If the <em>Name</em> field of a column is changed, this will trigger a batch
operation in which the corresponding label/relation will be renamed in
all the children.</p>
+<h3>Read-only tables</h3>
+<p>On a <a href="#root/_help_CoFPLs3dRlXc">read-only</a> table, the cells can't
+ be edited and the rows can't be dragged. The <em>New row</em> and <em>New column</em> buttons
+ are hidden, and the context menus offer only what leaves the notes as they
+ are: sorting and hiding columns, and opening the notes. Columns can still
+ be resized and reordered, but the layout isn't saved.</p>
<h2>Working with the data</h2>
<h3>Sorting by column</h3>
<p>By default, the order of the notes matches the order in the&nbsp;<a class="reference-link"
diff --git a/docs/User Guide/User Guide/Collections/Table.md b/docs/User Guide/User Guide/Collections/Table.md
index c05e0cf4a3..3ebc661e87 100644
--- a/docs/User Guide/User Guide/Collections/Table.md
+++ b/docs/User Guide/User Guide/Collections/Table.md
@@ -86,6 +86,10 @@ It is possible to edit a column by right clicking it and selecting _Edit column.
If the _Name_ field of a column is changed, this will trigger a batch operation in which the corresponding label/relation will be renamed in all the children.
+### Read-only tables
+
+On a [read-only](../Basic%20Concepts%20and%20Features/Notes/Read-Only%20Notes.md) table, the cells can't be edited and the rows can't be dragged. The _New row_ and _New column_ buttons are hidden, and the context menus offer only what leaves the notes as they are: sorting and hiding columns, and opening the notes. Columns can still be resized and reordered, but the layout isn't saved.
+
## Working with the data
### Sorting by column