Skip to content

Sort the whole table by a column in the Tables explorer - #9194

Draft
cstns wants to merge 1 commit into
mainfrom
9193-tables-sort
Draft

cstns wants to merge 1 commit into
mainfrom
9193-tables-sort

Conversation

@cstns

@cstns cstns commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Closes #9193

Since paging landed the Tables grid couldn't be sorted at all, and before that a header click only sorted the rows on screen. Clicking a column header now sorts the whole table by that column. It's the first of the 3.4 pieces of #9160.

The first click sorts largest first, the second smallest first, and the third goes back to the table's own order, the same cycle every other grid in the app uses. Changing the sort takes you back to the first page, paging carries on in the sorted order, and switching to another table drops the sort. While the sorted page loads the grid shows the same placeholder rows it does when changing page.

The data API takes sort and dir for this. The sorted column goes first and the primary key (or the row position when there isn't one) stays behind it, so rows holding the same value keep a fixed order from one page to the next. Empty values go wherever Postgres puts them, last when ascending and first when descending. The route also has its own query schema now instead of the shared pagination one, since it pages by number and has no cursor or search. A column that doesn't exist, or one whose values can't be put in order (plain json for one), comes back as a 400 with a readable message instead of a 500, and the page shows it as a warning.

Not every column offers sorting. JSON, binary and list columns don't, and neither do types the page has no friendly name for, since Postgres can't order some of those. Text sorts the way Postgres sorts text, so "item 9" comes after "item 57".

The shared ff-data-table got a small server-side-sort switch so it shows the rows in the order they arrive rather than sorting the page itself. It's off by default, so no other table changes. The Sort button from the mockups isn't here, the header does the same job while there's one column to sort by.

Checked in the browser on a 57 row table: both directions, the reset on the third click, paging through a sorted table, switching tables, and the columns that don't offer sorting. Also called the API directly for a missing column, a json column and where empty values land, and added tests for the query, the route, the store, the grid and the page.

@cstns cstns self-assigned this Nov 16, 2026
@cstns cstns added this to the 3.3 milestone Nov 16, 2026
@cstns cstns moved this to In Progress in 🛠 Development Nov 16, 2026
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.87097% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.71%. Comparing base (509d231) to head (ba0a7e0).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
forge/ee/lib/tables/drivers/postgres-localfs.js 0.00% 2 Missing ⚠️
forge/ee/lib/tables/drivers/postgres-supavisor.js 0.00% 2 Missing ⚠️
forge/ee/routes/tables/index.js 83.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9194   +/-   ##
=======================================
  Coverage   80.71%   80.71%           
=======================================
  Files         477      477           
  Lines       26380    26407   +27     
  Branches     7025     7036   +11     
=======================================
+ Hits        21292    21314   +22     
- Misses       5088     5093    +5     
Flag Coverage Δ
backend 80.71% <83.87%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cstns cstns added the blocked label Nov 16, 2026
@cstns cstns moved this from In Progress to Blocked in 🛠 Development Nov 16, 2026

This branch was successfully deployed

1 active deployment
staging — ba0a7e03 Deployed Nov 16, 2026 by cstns via Deploy application #13105
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Blocked

Development

Successfully merging this pull request may close these issues.

Tables: sort the whole table by a column

1 participant