Lens withCount and sortable field fails on sort #6645
Unanswered
FN-FAL113
asked this question in
Ideas & Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description:
When a query utilizes
![image](https://private-user-images.githubusercontent.com/88238718/389453406-ef3dc8dd-99ef-41a4-916b-047ffa515c91.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMzQ4MDAsIm5iZiI6MTczOTAzNDUwMCwicGF0aCI6Ii84ODIzODcxOC8zODk0NTM0MDYtZWYzZGM4ZGQtOTllZi00MWE0LTkxNmItMDQ3ZmZhNTE1YzkxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDE3MDgyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYwN2QxNjBhYzRlYzE3NjA1MDNmN2Y2ODNmMjcyNzhiNWI1NDZkMzJlYmE0NGJiZTUzZjNhMGFmNDA4ODQ5MzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Ak-Y-7hTDFee_9_kvO6tgVclvsC4ebbrBczHPVYc0ww)
withCount
and making a fieldsortable
, the raw sql query that gets added by #sortable function prefixes an aliased subquery field with the table name which causes an error:Error Code: 1054. Unknown column 'categories.products_count' in 'order clause'
I am not sure if the query is sql version dependent but I'm thinking that aliased fields should not be prefixed since its not a default table field.
Faulty
Working
Detailed steps to reproduce the issue on a fresh Nova installation:
Create lens class
Define the query and filter just like in the image below and also making the aliased field sortable
![image](https://private-user-images.githubusercontent.com/88238718/389435575-9c0d1b43-c4b1-4ba9-88ed-206f1657df53.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMzQ4MDAsIm5iZiI6MTczOTAzNDUwMCwicGF0aCI6Ii84ODIzODcxOC8zODk0MzU1NzUtOWMwZDFiNDMtYzRiMS00YmE5LTg4ZWQtMjA2ZjE2NTdkZjUzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDE3MDgyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdlMzM0NGFlMjlmODlhMmY0NDkzY2JhMTU5NmI5MTg2MDU1M2ViYjNkMjkxMGRjNzc1NGI4YjcxZGVmYTNmOWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.5Wj89b0jY4MaNGRAG-GxVJPV1pyIkksLE3gaSDQ_Feo)
Sort the field in the actual nova application in the browser
Beta Was this translation helpful? Give feedback.
All reactions