Skip to content

Resizing no longer sorts; Columns can be moved by dragging - #602

Merged
buzzia2001 merged 2 commits into
codefori:mainfrom
andreas-prouza:main
Nov 25, 2026
Merged

buzzia2001 merged 2 commits into
codefori:mainfrom
andreas-prouza:main

Conversation

@andreas-prouza

Copy link
Copy Markdown
Contributor

Changes

Two fixes to the SQL results grid (src/views/html/dataTable.ts):

Resizing a column no longer sorts it
When you drag a column border, the mouse is usually released over the header rather than the resize grip, so the browser sends the click to the header and it toggles the sort. Now the click right after a resize is ignored. A plain click on a header still sorts.

Columns can be moved by dragging their header

  • Drop a header on the left or right half of another header to place the column there. An accent-coloured bar shows where it will land, and the dragged header is dimmed.
  • The column moves in the header, in rows already loaded, in rows that stream in later, and in the "Add Row" draft row.
  • Column widths are now stored per column, so a resized column keeps its width when moved. Double-clicking the grip still resets it.
  • Sorting, cell editing, header hover details and the generated UPDATE/INSERT statements are unaffected, because they look columns up by id or index, not by position.
  • A drag that starts on the resize grip resizes and does not move the column.

Limitations

  • The column order is kept only while the results panel is open. "Move to editor" and new queries start with the original order.
  • In the "Add Row" draft row, focus starts in the first editable column of the query's original order, not the first one shown on screen.

How to test this PR

  1. Run a query with several columns, e.g. select * from <lib>.<table>.
  2. Drag a column border: the column resizes and the sort stays the same.
  3. Drag a header onto another header: the column moves, and its data moves with it.
  4. Scroll so more rows load: new rows use the new column order.
  5. On an updatable table, edit a cell and use Add Row after moving columns: the statements still name the right columns.

Checklist

  • have tested my change
  • have created one or more test cases
  • updated relevant documentation
  • Remove any/all console.logs I added
  • have added myself to the contributors' list in CONTRIBUTING.md

@buzzia2001

Copy link
Copy Markdown
Member

Hi @andreas-prouza,
I really like this feature, thank you so much!

@buzzia2001
buzzia2001 merged commit 6513c62 into codefori:main Nov 25, 2026
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