Skip to content

Commit

Permalink
sort colsWithMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
rtholmes authored and winstan committed May 8, 2024
1 parent e648315 commit 13df441
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/portal/frontend/src/app/util/SortableTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down

0 comments on commit 13df441

Please sign in to comment.