[Resolved] Views using repeating fields can't be sorted correctly on front end
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I am using Beaver Builder (NOT repeat NOT the Block Editor)
I am trying to sort a set of repeating fields in the same order in which they are displayed on the dashboard using Views.
However the sort order on the front end appears to be somewhat random.
I just tested this on my local site where it works as expected, I'm not sure why it wouldn't be working in your case.
Can you go to Toolset > Settings > Front-end Content and enable the advanced debug mode.
Then visit the post where the View is displayed and check the debug pop-up.
In the screenshot from my site you can see that the query arguments specify that the ordering should be by the custom field toolset-post-sortorder, and the generated MySQL query does indeed order by that custom field.
That does look right, perhaps there is something wrong in how the toolset-post-sortorder field is stored.
Let me mark your next reply as private so that we can get log-in credentials from you—you may want to create a temporary admin user for us to use that you can later delete. And be sure to have a current backup of your site.
Can you also confirm which View we are looking at and where it is displayed?
I was able to make the repeating field entries show in the order that you wanted by making the following changes, in the ordering section:
1. The 'toolset-post-sortorder' field stores the numerical values. So the comparison type needs to be 'As a number' instead of 'As a native custom field'.
2. The numbers in this field are stored in the ascending order. For showing the repeating field group entries in the same order as on the post-edit screen, the ordering direction needs to be 'Ascending'.
( screenshot: hidden link )
After making these changes, I cleared the 'SG cache', and repeating field items are showing in the correct order now.
( screenshot: hidden link )