Sort by column in a subtable

@Teodor now that we have subtables how does the sorting by column work if I’m sending a column from the subtable as the $_GET.sort query parameter?

I’m finding some inconsistent results.

By inconsistent I really mean not working at all :slight_smile:

I’ve tried column and table.column as values for $_GET.sort

@Teodor I am assuming this is an omission in the functionality and @patrick will have to do some trickery to the sort method so it handles subtables, right?

If that is the case I suggest using table.column as a sort value to avoid ambiguity.

Hi @patrick,

Is this possible or not implemented?

You can sort the main table and sort the sub tables, but you can’t sort the main table with a field from the sub table. You can do it afterwards by sorting the result data, it is not possible to do this directly on the query since it are 2 separate queries.

Thanks for the info. That would work on a normal query.

Unfortunately I can’t see this working on paged queries as I will only be able to sort the current page and not the whole query.

Anything you can think of for paged queries @patrick? Going the join route I guess.

If you want to do server-side paging then you will probably need to use joins in the query. Alternative you could retrieve all records and do the paging on the client, depending on how large the recordset can become.

1 Like