Auto sort structure field entries in panel

Iโ€™ve tried that out and indeed - it works magically :smiley:

@firekayne Maybe a plugin or a field kills the sorting hook? In my case I deactivated MinifyHTML when Iโ€™m logged in.

@servicethinker I think you are right, the issue might be related to a field that does not work. I tested the wysiwyg field yesterday and today the hook stopped working. Or rather, it worked on a file basis but did not reflect the changes in the panel.

Sorting a panel field with event dates I get strange results: The sorting starts at a certain point again.
Some dates are sorted correct (newest as first), but then some dates are missing, the following all have the correct order. The missing ones are stacked at the endโ€”again in two stacks of which the first just contains one date.
All the events have a starting date, all but two have also a starting time. Just this two last for some days, they have therefore also an ending date but no starting time.
Any idea?

Hi,

After all of that, Iโ€™m wondering what is the best way to make entries unsortable by hand ?

Thanks !

There is no option to make the structure fields unsortable. You could, however, create your custom version of the field without sorting.

Yes that is a way.
Duplicate code VS unused option, I think I will do it.

Thank you again !

Would it make sense to have it as a built in feature @texnixe @lukasbestle? I was in the same situation today.

I add things with the structure field that should only appear once. For example look at these opening hours:

In this case I use my Snippetfield but it still shows the problem of sorting.

If they would autosort alphabetically or by number we would have the possibility to get really nice results. It would also be much simpler than create a hook for it.

1 Like

There is a pull request for that: https://github.com/getkirby/panel/pull/749

I actually used thoses changes in projects when needed. Would be great if this feature could be added in the future.

2 Likes

Auto sorting and prevent manual sorting works great in V2.5.n

See: https://getkirby.com/docs/cheatsheet/panel-fields/structure

Thank you, Kirby-Crew! :sunny: