Get manual sort from content in content.query?

For: EXP 5.1.0

If I fetch all child content with content.getChildren I automatically get them sorted if manual sort has been activated in the admin. This is very nice.

But, if I want to do a more complex query and need to use the content.query (because .getChildren doesn’t support the “query” param) I can’t seem to sort it on the sort values from admin. When I log the data I can’t see any values to sort on, like “_sort” or “sort” or similar. I’ve tried sending in the “sort”-param with values like “sort ASC” or “_sort ASC” but it doesn’t seem to have any effect.

So how would I go about respecting the manual sorting from admin when using content.query?

You cannot do that, since when doing a query, its nothing that restricts the result to be all children of one parent.

But; There is a task waiting to add a query-parameter to the getChildren command:

@srs @tsi I think this issue maybe should be prioritized now?

Edit; Unofficial you can try to use “_manualordervalue” desc as a shortcut as a workaround for now.

1 Like

Cool ^^

I’ll manage with getChildren for now and some minor filtering in my controller.js.

Suggested solution accepted as answer to this topic, so it is now closed. New replies are no longer allowed.

1 Like