mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
feat(views/table): add option to clear sorting
This commit is contained in:
parent
d8d95db4ec
commit
7acd300163
@ -15,7 +15,10 @@ export function setupContextMenu(tabulator: Tabulator, parentNote: FNote) {
|
|||||||
function showColumnContextMenu(_e: UIEvent, column: ColumnComponent, tabulator: Tabulator) {
|
function showColumnContextMenu(_e: UIEvent, column: ColumnComponent, tabulator: Tabulator) {
|
||||||
const e = _e as MouseEvent;
|
const e = _e as MouseEvent;
|
||||||
const { title, field } = column.getDefinition();
|
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({
|
contextMenu.show({
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
@ -56,6 +59,11 @@ function showColumnContextMenu(_e: UIEvent, column: ColumnComponent, tabulator:
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Clear sorting",
|
||||||
|
enabled: sorters.length > 0,
|
||||||
|
handler: () => tabulator.clearSort()
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
selectMenuItemHandler() {},
|
selectMenuItemHandler() {},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user