From 187003200806b9bbd61601d7fac4e63394d42858 Mon Sep 17 00:00:00 2001 From: reid holmes Date: Tue, 30 Apr 2024 13:52:52 -0700 Subject: [PATCH] sort colsWithMetadata --- packages/portal/frontend/src/app/util/SortableTable.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/portal/frontend/src/app/util/SortableTable.ts b/packages/portal/frontend/src/app/util/SortableTable.ts index 870c062be..8c9d8b84e 100644 --- a/packages/portal/frontend/src/app/util/SortableTable.ts +++ b/packages/portal/frontend/src/app/util/SortableTable.ts @@ -273,10 +273,10 @@ export class SortableTable { private findColsWithMetadata(divName: string): number[] { const root = document.querySelector(this.divName); const rows = root.querySelectorAll("table tr"); - const colsWithMetadata: number[] = []; + let colsWithMetadata: number[] = []; // tslint:disable-next-line - for (let i = 0; i < rows.length; i++) { + for (let i = 1; i < rows.length; i++) { // skip the header row const cols = rows[i].querySelectorAll("td, th"); // tslint:disable-next-line @@ -293,6 +293,9 @@ export class SortableTable { } } + // sort numbers ascending + colsWithMetadata = colsWithMetadata.sort((a, b) => a - b); + Log.info("SortableTable::findColsWithMetadata() - cols: " + JSON.stringify(colsWithMetadata)); return colsWithMetadata; }