Skip to content

Add row-number column to tables - #420

Open
Krish-Parmar22 wants to merge 1 commit into
avgupta456:masterfrom
Krish-Parmar22:table-row-numbers
Open

Krish-Parmar22 wants to merge 1 commit into
avgupta456:masterfrom
Krish-Parmar22:table-row-numbers

Conversation

@Krish-Parmar22

Copy link
Copy Markdown

Closes #265, closes #379, closes #319

All three issues ask for the same thing: a row number that reflects the current sort and filter, and continues across pages. Today, sorting the Teams table by e.g. Energized RP leaves "EPA Rank" showing total-EPA ranks (28, 16, 25, 10…), so there's no way to read off "this team is 3rd in Energized RP", and page 4 gives no hint whether you're looking at row 31 or 40.

Changes

frontend/src/components/Table/Table.tsx — new showRowNumbers prop renders a leading # column. The number is pageIndex * pageSize + i + 1 over TanStack's sorted+filtered row model, so it follows whatever sort is active and reads 11–20 on page 2. It is rendered outside the column map, so the existing column-divider logic (which indexes columns by position) and the CSV export are unaffected. The header cell spans all header rows for tables with grouped headers (BreakdownTable).

frontend/src/components/Table/InsightsTable.tsx — a list-numbered icon in the toolbar toggles the column, on by default (defaultShowRowNumbers prop to change it per table). filteredData is now useMemo'd on [currData, search, searchCols]; without that, toggling the column handed TanStack a new data array every render and reset pagination to page 1.

Verified

next lint, tsc --noEmit, next build pass. Checked in the browser against prod bucket data:

  • Teams sorted by Energized RP 🔽: # reads 1–10 while EPA Rank shows 28, 16, 25, 10…
  • Page 2: # reads 11–20, footer "11 – 20 of 3724".
  • Toggling the column off and on while on page 2 stays on page 2.

@vercel

vercel Bot commented Sep 15, 2026

Copy link
Copy Markdown

@Krish-Parmar22 is attempting to deploy a commit to the avgupta456's projects Team on Vercel.

A member of the Team first needs to authorize it.

Table.tsx gains a showRowNumbers prop that renders a leading '#' column.
The number is taken from the sorted, filtered row model and offset by the
current page, so it follows any sort and continues across pages
(11-20 on page 2). It is rendered outside the column map, so column
dividers and the CSV export are unaffected.

InsightsTable.tsx exposes a toolbar icon to toggle the column (on by
default; defaultShowRowNumbers prop to change it). filteredData is
memoized so toggling display-only state does not hand TanStack a new
data array, which would reset pagination to page 1.

Closes avgupta456#265, closes avgupta456#379, closes avgupta456#319

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: row numbers in all displays Insights: Numerical Rank with any sort Add optional rank column to tables

1 participant