Sorting By Incorrect Column On Duplicate Column Names

Created on 28 September 2023, 9 months ago

Problem/Motivation

When creating a view with one or more table relationships, it's possible that you have duplicate column names.
i.e. table1 > name
table2 > name

When you try to make both fields sortable, clicking on Name (table 2) column, actually sorts the table by Name (table 1).

The problem appears to be in:
/modules/contrib/views_aggregator/src/Plugin/views/style/Table::compareResultRows line 1410.

Steps to reproduce

1. Create a new view that against a table.
2. Add a relationship to a 2nd table that has a duplicate column name. i.e Table 1 > UserID, Table 2 > UserID.
3. Make both columns sortable in the Table Aggregator Settings.
4. View the report and sort on each of the columns.
5. They'll both sort based on the first column, never the 2nd.

Proposed resolution

I created a workaround by replacing on line 1410: $field_handler->options['entity_field'] with $this->active.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mitchmccoy

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024