5.92: Setting DEFAULT SORT ORDER in AG and an order in _init fails

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
Post Reply
User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1165
Joined: 2019-05-21 22:42
Location: Germany
Contact:

5.92: Setting DEFAULT SORT ORDER in AG and an order in _init fails

Post by onoehring » 2021-01-07 13:42

Hi,

I have set a default sort order in AG.
When I set an additional sort order in the _init function (hooks/tablename.php -> ) the page is not displayed at, but I get an error thrown.
AG Setting:
l8.png
l8.png (7.36 KiB) Viewed 1987 times
Code in _init:

Code: Select all

$options->DefaultSortField = 'JobFertiggestellt DESC, Log_Fertig_Zeit DESC, BenoetigtAm ASC, ID_Container_Platz_aktuell DESC';
SQL in the error shown, when I open the page (I am marking the wrong SQL - so unfortunately I can not use the code-tag) - there is an extra desc added. I would think if I define an extra $options->DefaultSortField the AG application would/should ignore the settings from AG:
-----------------------
SELECT
... all my fields...
FROM
... my table/joins ...
ORDER BY
JobFertiggestellt DESC,
Log_Fertig_Zeit DESC,
BenoetigtAm,
ID_Container_Platz_aktuell DESC
desc
LIMIT 0, 50
-----------------------

I am not sure if this also happens when I do not set descending as sortorder in AG.

Olaf

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: 5.92: Setting DEFAULT SORT ORDER in AG and an order in _init fails

Post by pbottcher » 2021-01-07 15:57

Hi,
I would assume it does not happen if you do not set the default sorting.

For your case, try to leave out the last desc in the init function.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1165
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: 5.92: Setting DEFAULT SORT ORDER in AG and an order in _init fails

Post by onoehring » 2021-01-08 08:30

Hi pbötcher,

I actually set the default sort order in AG by accident :-) ... but I would think it's a but that the described happens.

Have a great and healthy new year
Olaf

Post Reply