pdoResources incorrect sorting order

Hello. Guys encountered a strangeness. I had a call in order - code:

[[!pdoResources?
    &parents=`120,126,130,134,139,141,144,146,149,153,154,155,156,157,158,161,286`
    &depth=`1`
    &tpl=`raspisanieDoctorsFull`
    &limit=`140`
    &includeTVs=`contentraspisanie`
    &sortdir=`ASC`
]] 

Suddenly the output changed, but I haven’t changed anything for a long time. Right now I couldn’t set a normal sequence. That all resources were derived from the categories, then from the next one. Now, for example, I have an incorrect conclusion and a number of resources are not in their categories at all

displaying now

So what’s your sortby field?
In the code you posted it’s not specified and in the screenshot it’s menuindex.

Sorting only by menuindex doesn’t make much sense when you query the data from different folders. In each folder the menuindex values start with 0. So there are different resources with the same menuindex. The order of the resources with the same menuindex is not defined and is basically random.

we need a sequence of the following type:

Parent 1
Child
Child
Child
Parent 2
Child
Child
To make it go with ID 120 - 157

I didn’t understand the first phrase. I hope I gave the right answer

Maybe something like this works:

&sortby=`{"parent":"ASC","menuindex":"ASC"}`

thanks. almost. multiple IDs in the wrong sequence. Maybe you need to specify something for the pages in the settings?

can I set a strict order? output by id, as specified?

Maybe this works:

&sortby=`FIELD(parent, 120,126,130,134,139,141,144,146,149,153,154,155,156,157,158,161,286 ) ASC, menuindex DESC`
&sortdir=``
1 Like

cool.thanks. changed &sortby=FIELD(parent, 120,126,158,130,286,139,134,141,144,146,149,153,154,155,161,156,157) ASC, menuindex ASC everything seems to be ok