refactor(views/table): use slightly more performant formatter for row number

This commit is contained in:
Elian Doran 2025-07-14 11:30:46 +03:00
parent 8d29c5fe1b
commit 28f4aea3d5
No known key found for this signature in database
2 changed files with 10 additions and 8 deletions

View File

@ -51,7 +51,7 @@ export function buildColumnDefinitions(info: AttributeDefinitionInformation[], m
resizable: false, resizable: false,
frozen: true, frozen: true,
rowHandle: movableRows, rowHandle: movableRows,
formatter: RowNumberFormatter formatter: RowNumberFormatter(movableRows)
}, },
{ {
field: "noteId", field: "noteId",

View File

@ -36,13 +36,15 @@ export function NoteTitleFormatter(cell: CellComponent) {
return $noteRef[0].outerHTML; return $noteRef[0].outerHTML;
} }
export function RowNumberFormatter(cell: CellComponent) { export function RowNumberFormatter(draggableRows: boolean) {
return (cell: CellComponent) => {
let html = ""; let html = "";
if (cell.getColumn().getDefinition().rowHandle) { if (draggableRows) {
html += `<span class="bx bx-dots-vertical-rounded"></span> `; html += `<span class="bx bx-dots-vertical-rounded"></span> `;
} }
html += cell.getRow().getPosition(true); html += cell.getRow().getPosition(true);
return html; return html;
};
} }
function buildNoteLink(noteId: string) { function buildNoteLink(noteId: string) {