Skip to content

feat: drag-and-drop column reordering and always-visible sort icons - #1877

Merged
rtritto merged 1 commit into
mongo-express:masterfrom
w3blogfr:feat/column-reorder-and-sort-icons
Jun 13, 2026
Merged

rtritto merged 1 commit into
mongo-express:masterfrom
w3blogfr:feat/column-reorder-and-sort-icons

Conversation

@w3blogfr

@w3blogfr w3blogfr commented Jun 13, 2026 •

Copy link
Copy Markdown
Contributor

This change is Reviewable


What this does

Two quality-of-life improvements to the collection view table headers:

1. Columns can be reordered by drag-and-drop

  • a drag handle appears on the left of each column header when hovering it
  • dragging it over another column moves the whole column (header + cells) there, with a visual drop indicator
  • the order is persisted per database/collection in the browser's localStorage (key mongo-express:columnOrder:<db>/<collection>) and is re-applied on every page load — it survives searches, sorting and pagination
  • columns not present in the saved order (new fields) keep their natural position at the end
  • purely client-side: no server or API change

The drag only starts from the dedicated handle, on purpose: making the whole <th> draggable would swallow the click event on any slight mouse movement and break click-to-sort.

image image

2. Clearer sort affordance

  • every column now always shows a sort icon: dimmed when the column is not sorted, highlighted up/down arrow when it is — previously nothing indicated that headers are clickable until a column was sorted
  • headers no longer wrap on several lines when a column name is short and the sort icon used to overflow (white-space: nowrap)
  • header text is not selectable anymore (user-select: none), which previously interfered with click-to-sort (a click that selected text was ignored)

Before, arrow was on 2 lines
image
After, arrow is always on same line
image

How to verify

  1. Open any collection
  2. Hover a column header → a drag handle appears; drag it onto another column → the column moves
  3. Reload the page, navigate, search, sort → the custom column order is kept
  4. Open the same collection in another browser/profile → default order (storage is local)
  5. Click headers → sorting still works exactly as before

- columns can be reordered by drag-and-drop via a handle shown on
  header hover; order is persisted per collection in localStorage
- sort icons are always visible (dimmed when inactive) and headers
  no longer wrap on multiple lines
@rtritto
rtritto merged commit bd7ff8a into mongo-express:master Jun 13, 2026
5 checks passed
@rtritto

rtritto commented Jun 13, 2026

Copy link
Copy Markdown
Member

Thanks!

@w3blogfr
w3blogfr deleted the feat/column-reorder-and-sort-icons branch September 28, 2026 00:17
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.

2 participants