Grid sorting sorts by id (in case of a FK) instead of shown value (eg. name). Is this normal?

18 views
Skip to first unread message

jcrm...@gmail.com

unread,
Apr 29, 2019, 6:26:10 PM4/29/19
to web...@googlegroups.com
Grid sorting sorts by id (in case of a FK) instead of shown value (eg. name). Is this normal?

The only way I found to correct this behavior was to change the grid's table to a query, where in this query I include all the foreign fields (eg. name) directly and remove al the foreign keys.
Is this the correct/only way to solve it?


web2py 2.18.5
Python 3.7.1 x86
Firefox 66.0.3 x64
Windows 7 Pro x64 SP1+all upds

Anthony

unread,
Apr 29, 2019, 6:56:18 PM4/29/19
to web2py-users
Yes. It shows the values from the foreign table via "recursive selects" (i.e., a separate query for each displayed row after the initial set of records is fetched from the database), so it is not able to use that information for sorting (which would require the initial query to be a join with the foreign table).

Anthony

jcrm...@gmail.com

unread,
Apr 29, 2019, 6:58:19 PM4/29/19
to web2py-users
So the only way to correct it is the way I used. Thanks Anthony.
Reply all
Reply to author
Forward
0 new messages