From 7acd300163894287b36385636c34f55e21a6291d Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 13 Jul 2025 16:41:43 +0300 Subject: [PATCH] feat(views/table): add option to clear sorting --- .../widgets/view_widgets/table_view/context_menu.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/client/src/widgets/view_widgets/table_view/context_menu.ts b/apps/client/src/widgets/view_widgets/table_view/context_menu.ts index db877f7db..e7258aa03 100644 --- a/apps/client/src/widgets/view_widgets/table_view/context_menu.ts +++ b/apps/client/src/widgets/view_widgets/table_view/context_menu.ts @@ -15,7 +15,10 @@ export function setupContextMenu(tabulator: Tabulator, parentNote: FNote) { function showColumnContextMenu(_e: UIEvent, column: ColumnComponent, tabulator: Tabulator) { const e = _e as MouseEvent; const { title, field } = column.getDefinition(); - const sorter = tabulator.getSorters().find(sorter => sorter.field === field); + + const sorters = tabulator.getSorters(); + const sorter = sorters.find(sorter => sorter.field === field); + contextMenu.show({ items: [ { @@ -56,6 +59,11 @@ function showColumnContextMenu(_e: UIEvent, column: ColumnComponent, tabulator: ]) } ] + }, + { + title: "Clear sorting", + enabled: sorters.length > 0, + handler: () => tabulator.clearSort() } ], selectMenuItemHandler() {},