grav icon indicating copy to clipboard operation
grav copied to clipboard

Ordering variables with NULL value

Open petira opened this issue 1 year ago • 0 comments

If I order the list of pages according to the (custom) page variable, which is optional, if this does not exist (it has a value of NULL), in the case of ascending ordering, the pages with NULL are at the end, in the case of descending ordering, the pages with NULL are at the beginning. But I would need the NULL values to be ordered before 0, or vice versa after 0.

Specifically in the case of {% set options = { items: {'@page.children': '/my-page'}, 'limit': 10, 'order': {'by': 'header.progress', 'dir': 'desc'}, 'pagination': false } %}, instead of the following output:

NULL
5
4
3
2
1
0

I want this output:

5
4
3
2
1
0
NULL

Now I solve it by double browsing, but it is not very comfortable, and mainly it takes twice as much time.

petira avatar Jan 18 '24 14:01 petira