Problem sorting tables when query uses alias

Wappler Version : 4.6.2
Operating System : Windows 10
Server Model: PHP
Database Type: MySQL
Hosting Type:

Expected behavior

I created a table using the Bootstrap table generator. The table rows are populated by a paged query. The query has joins. Some of the fields returned by the query use an alias.

When in the client side I try to sort by a column (by clicking on its header) that shows a non-aliased field, the API works fine and the table sorts properly. This is the expected behaviour. The browser console shows a good result:
image

If, however, I try to sort by a column that shows an aliased field, the API works fails. This is the unexpected behaviour. The browser console shows this:
image

If I remove the alias in the query and return the dataset using the “raw” column names, the table behaves well – but I lost the capability of aliasing columns and with that, all the value that this SQL capability adds.

BTW, the problem happens independently of whether the aliased column is from the main table (the one in the FROM clause) or from a joined table (one in the JOIN clause).

Many thanks,

Community Page
Last updated: