Skip to content

🔢 Reorder and sort table columns#2481

Merged
AndyScherzinger merged 8 commits intomainfrom
feat/607/reorder-and-sort-table-columns
Apr 21, 2026
Merged

🔢 Reorder and sort table columns#2481
AndyScherzinger merged 8 commits intomainfrom
feat/607/reorder-and-sort-table-columns

Conversation

@AndyScherzinger
Copy link
Copy Markdown
Member

@AndyScherzinger AndyScherzinger commented Apr 14, 2026

Resolves #607 implementing the same mechanism views already offer, but for tables

  • Column Order: Added column_order to tables_tables (DB migration), extended the Table entity, TableService, and controllers to persist and apply it, and exposed a drag-and-drop ColumnOrderList.vue in the "Edit table" modal.
  • Default Sort: Added sort to tables_tables, wired it through the Table entity, TableService, and controllers, and added a DefaultSortRules.vue component to the modal.
  • Import/Export: Both fields are preserved through scheme export/import and user-migration, with round-trip tests confirming correctness.
  • Testing: Added / adapted unit up to e2e tests.
  • OpenAPI Spec: Updated and regenerated openapi.json and its TypeScript counterpart.
Dialog old Dialog new (2 sort items) Dialog new (1 sort item) Dialog view new (2 sort items)
2026-04-16 14_13_08-Tabellen - Nextcloud — Mozilla Firefox 2026-04-16 14_21_35-Welcome to Nextcloud Tables! - Tables - Nextcloud — Mozilla Firefox 2026-04-16 14_10_12-Welcome to Nextcloud Tables! - Tables - Nextcloud — Mozilla Firefox 2026-04-16 14_22_00-Check yourself! - Tables - Nextcloud — Mozilla Firefox

JSON Export
See last section for order/sorting block (like for views)

{
   "title":"Welcome to Nextcloud Tables!",
   "emoji":"\ud83d\ude80",
   "columns":[
      ...
   ],
   "views":[
      ...
   ],
   "description":"A B C D",
   "tablesVersion":"2.0.1",
   "columnOrder":[
      {
         "columnId":4,
         "order":1,
         "readonly":false,
         "mandatory":false
      },
      {
         "columnId":2,
         "order":2,
         "readonly":false,
         "mandatory":false
      },
      {
         "columnId":1,
         "order":3,
         "readonly":false,
         "mandatory":false
      },
      {
         "columnId":3,
         "order":4,
         "readonly":false,
         "mandatory":false
      }
   ],
   "sort":[
      {
         "columnId":3,
         "mode":"DESC"
      }
   ]
}

@AndyScherzinger AndyScherzinger added enhancement New feature or request 2. developing Work in progress labels Apr 14, 2026
@AndyScherzinger AndyScherzinger force-pushed the feat/607/reorder-and-sort-table-columns branch from 6d172fa to 8b814f8 Compare April 14, 2026 21:45
@AndyScherzinger AndyScherzinger changed the title Reorder and sort table columns 🔢 Reorder and sort table columns Apr 14, 2026
@AndyScherzinger AndyScherzinger force-pushed the feat/607/reorder-and-sort-table-columns branch from beb8965 to 57fb13d Compare April 15, 2026 10:30
AI-assistant: GitHub Copilot v0.43.0 (Claude Sonnet 4.6)

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
AI-assistant: GitHub Copilot v0.43.0 (Claude Sonnet 4.6)

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
AI-assistant: GitHub Copilot v0.43.0 (Claude Sonnet 4.6)

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
…able entity

AI-assistant: GitHub Copilot v0.43.0 (Claude Sonnet 4.6)

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@AndyScherzinger AndyScherzinger force-pushed the feat/607/reorder-and-sort-table-columns branch 3 times, most recently from 99efeb0 to 2c6d286 Compare April 15, 2026 12:57
…table entity

AI-assistant: GitHub Copilot v0.43.0, Claude Code v2.1.109 (Claude Sonnet 4.6)

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@AndyScherzinger AndyScherzinger force-pushed the feat/607/reorder-and-sort-table-columns branch from 8f572d9 to f48f67b Compare April 15, 2026 19:31
@AndyScherzinger AndyScherzinger marked this pull request as ready for review April 15, 2026 20:35
@AndyScherzinger AndyScherzinger added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Apr 15, 2026
Copy link
Copy Markdown
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very nice! 2 things:

  • Wording detail: Heading should be "Default sorting" instead of "Default sort"
  • The default sorting can be deleted via the trash icon on the right. In Tables right now the default is new additions on the bottom, something we could also include there? That way it would be more obvious than being an "empty" state.

@jancborchardt jancborchardt moved this to 🏗️ At engineering in 🖍 Design team Apr 16, 2026
@samin-z samin-z self-requested a review April 16, 2026 08:02
Copy link
Copy Markdown
Member

@marcoambrosini marcoambrosini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one!
One comment about the info text of default sorting: I wonder if there's a way to make this explanation a bit more clear, I don't understand it 😅
Another minor improvement would be moving it to right after the heading instead of after the add rule button.

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
…ly if at least 2 sorting items are present

AI-assistant: Claude Code v2.1.109 (Claude Sonnet 4.6)

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@AndyScherzinger
Copy link
Copy Markdown
Member Author

Implemented @jancborchardt first comment and @marcoambrosini's feedback

Copy link
Copy Markdown
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noice

Copy link
Copy Markdown
Member

@marcoambrosini marcoambrosini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the addition :)

Comment thread lib/UserMigration/TablesMigrator.php
Comment thread lib/Service/RowService.php Outdated
Comment thread src/modules/main/partials/editTablePartials/DefaultSortRules.vue Outdated
…rent year for SPDX header

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@AndyScherzinger AndyScherzinger added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Apr 17, 2026
@AndyScherzinger AndyScherzinger requested a review from samin-z April 17, 2026 12:53
@AndyScherzinger AndyScherzinger added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Apr 17, 2026
@AndyScherzinger AndyScherzinger added this to the v2.1.0 milestone Apr 21, 2026
@AndyScherzinger AndyScherzinger merged commit 2b330ef into main Apr 21, 2026
72 of 76 checks passed
@AndyScherzinger AndyScherzinger deleted the feat/607/reorder-and-sort-table-columns branch April 21, 2026 10:25
@github-project-automation github-project-automation Bot moved this from 🏗️ At engineering to 🎉 Done in 🖍 Design team Apr 21, 2026
*/
#[NoAdminRequired]
public function createFromScheme(string $title, string $emoji, string $description, array $columns, array $views): DataResponse {
public function createFromScheme(string $title, string $emoji, string $description, array $columns, array $views, array $columnOrder = [], array $sort = []): DataResponse {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did not check further down the code, but $columnOrder and $sort are not tested or sanitized for expected input format.

#[NoAdminRequired]
#[RequirePermission(permission: Application::PERMISSION_MANAGE, type: Application::NODE_TYPE_TABLE, idParam: 'id')]
public function update(int $id, ?string $title = null, ?string $emoji = null, ?string $description = null, ?bool $archived = null): DataResponse {
public function update(int $id, ?string $title = null, ?string $emoji = null, ?string $description = null, ?bool $archived = null, null|array|string $columnSettings = null, null|array|string $sort = null): DataResponse {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here for $sort

public function update(int $id, ?string $title = null, ?string $emoji = null, ?bool $archived = null): DataResponse {
return $this->handleError(function () use ($id, $title, $emoji, $archived) {
return $this->service->update($id, $title, $emoji, null, $archived, $this->userId);
public function update(int $id, ?string $title = null, ?string $emoji = null, ?bool $archived = null, null|array|string $columnSettings = null, null|array|string $sort = null): DataResponse {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

Comment on lines +62 to +65
(int)$data[self::KEY_ID],
(int)$data[self::KEY_ORDER],
(bool)($data[self::KEY_READONLY] ?? false),
(bool)($data[self::KEY_MANDATORY] ?? false),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert this changes as well. It used to throw a PHP Error on construction, but now it silently succeeds with potentially flawed data.

Comment thread lib/Db/Table.php
}

/**
* @psalm-suppress MismatchingDocblockReturnType
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

red flag

Comment thread lib/Db/Table.php
}

/**
* @psalm-suppress MismatchingDocblockReturnType
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

red flag

Copy link
Copy Markdown
Member

@blizzz blizzz Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also not entirely confident about the code generated here, but it is a bit vague gut feeling yet.

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

Labels

3. to review Waiting for reviews enhancement New feature or request

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

Reorder columns / edit column order as default view

5 participants