By default, structure field entries are added to the bottom of the list. I need the new entry to always be added to the top of the list. Is that possible?
If you don’t have a key field to sortBy (ex. a readonly date field set to ‘now’), you still can add some CSS to customize your panel.
(A flip
property would be great for the Structure field, but not yet!)
Thank you for the suggestion, @jesuismaxime! Unfortunately, this particular structure field has loads and load of items (it paginates), so a CSS solution wouldn’t work - it would be awesome if it did!
In answer to your other question: no, there is no field we can sortBy. I’m not sure whether it’s possible to add a ‘hidden’ field with a timestamp, but if we can, that might be a workable hack…
It seems that Kirby always adds the same date if you set the default of a date field to now
, so that doesn’t seem to be an option. Also with a hook, that would only kick in after saving, which doesn’t make sense.
I think you would need a custom structure field, but then you would have to change the Vue part of the current field.
You might want to upvote this feature request: Structure field: option to add new to top of list · Issue #203 · getkirby/ideas · GitHub
Upvoted - thank you, @texnixe