Make rest api return rows in sorted order in new cockpit version


before some time the rest api returned the results of a collection in the order the user set them in cockpit (by dragging around).

Today the Rest result ordering seems to be done by the row ID or something and there is a new field “_o” in the collection row data. How do I get the Collection RestAPI to return rows in the order that the user has defined in cockpit (by dragging collection rows/entries around)?

I took a look at the collection controller which contains

if ($sort = $this->param(‘sort’, null)) $options[‘sort’] = $sort;

but when I put ?order= at the end of the rest api call I get an internal server error.

Thanks ahead


please try the following:



1 Like

perfect, works like a charm! thanks!

No, unfortunately that does not “work like a charm” at all. _o starts at zero in each folder in the new hierarchical sorting, so as soon as you have multiple folder this totally messes up the sort order compared to what you see in the Cockpit UI view. @artur you said on Gitter previously:

yes, this is still missing but will get implemented soon

… is that still so?

@jb-storms-media wanted a quick solution for not nested entries. But to answer your question: yes, the implementation will come, but I need to finish some contract work first.