I have setup a select field in the panel blueprint as stated in the docs like this:
field:
label: Field name
type: select
options: query
query:
page: some/site/page
fetch: grandchildren
value: '{{uid}}'
text: '{{title}}'
template: some-template`
This works perfectly, but as there are many “grandchildren” I would like to sort them alphabetically.
Now they appear to be grouped by “child”.
There must be some sorting logic involved in the “dynamic options”-code as you can “flip” it.
Can this be done?
Thanks!
You can sort the values using the sort
option:
field:
label: Field name
type: select
options: query
query:
page: some/site/page
fetch: grandchildren
value: '{{uid}}'
text: '{{title}}'
template: some-template
sort: asc
This is currently not documented, I have added it to our list.
2 Likes
Sorry @lukasbestle, I was too fast.
I tried this, but it doesn’t change anything…
Which Kirby version are you using?
Try this:
label: Field name
type: select
options: query
sort: asc
query:
page: some/site/page
fetch: grandchildren
value: '{{uid}}'
text: '{{title}}'
template: some-template
1 Like
Kirby 2.2.3 and panel 2.2.3
@texnixe, thank you very much Sonja!
This works like a charm now!