Skip to content

Sorting custom columns from module that extends another module containing all the data (collections, data providers, etc.)

I have two custom columns in UI grid (let’s call them subscribed_customers” and “unique_purchases”) created in particular listings that retrieve value from the database with logic. Working well so far.
The issue is that I’m unable to sort them in order. Attempts to do so give “Something went wrong”.
After looking in the log I discovered the error with a giant stack trace and tons of left joins:

 SQLSTATE[42S22]: Column not found: 1054 Unknown column 'subscribed_customers' in 'order clause'

How do I make them work? Do I have to come up with my own DataProvider? I have no idea at this point.

There was a similar issue 5 years ago, but it was not solved.