# Feature OP-18924 - Enable Column Sorting on Versions Overview

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-18924

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | 17.2.0 |
| Sprint | 17.2.0 |
| Backlog bucket |  |
| Votes |  |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

_No work packages_

## Technical Details

| Attribute | Value |
| --- | --- |
| Module | Modules and project features / Project settings |
| Feature Flag |  |
| Requires doc change | No |
| Enterprise plan |  |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Feature Lead |  |
| Developers | Klaus Zanders |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

**As** a project administrator or developer  
**I want to** sort the Versions table by any column (name, start date, finish date, status)  
**so that** I can quickly find and review versions by their timeline or status without manual scrolling

**Acceptance criteria**

  - Columns in the Versions table (Name, Start Date, Finish Date, Status) are sortable by clicking the column header.

  - Clicking a column header sorts ascending; clicking again sorts descending.

  - Sorting uses fully qualified column names (e.g. versions.effective\_date) to prevent ambiguous column SQL errors when table joins are present.

  - The default sort order is by Name ascending, consistent with existing behavior before this change.

  - Sorting state is reflected visually in the column header (arrow indicator).

  - Sorting works correctly across all project-shared version records.

**Technical notes**

The following methods were added/overridden in the Versions query component:

**a) sortable? and sortable\_column?(name)**

Enables sorting and restricts it to the allowed column whitelist: name, start\_date, effective\_date, status.

**b) sortable\_columns\_correlation**

Maps logical column names to fully table-qualified SQL column names to prevent ambiguous column errors when JOIN queries are present:

'name'           =\> 'versions.name'

'start\_date'     =\> 'versions.start\_date'

'effective\_date' =\> 'versions.effective\_date'

'status'         =\> 'versions.status'

**c) initial\_sort and initial\_sort\_correlation**

Sets the default sort to versions.name ASC, maintaining backwards-compatible behavior.

**d) Controller (show action)**

The show action fetches @project.shared\_versions — all sorting is handled at the query layer without changes to the view template.

**Permissions and visibility considerations**

  - *All users with access to Project Settings \> Versions*

  - *User does not have permission to view project settings or the Versions module is disabled*

**Translation considerations**

  - *No new UI strings are introduced by this change. Sorting is triggered via existing column headers (Name, Start Date, Finish Date, Status) which are already translated in all supported locales.*
