Fred Element Sorting Not Working?

Before I submit a bug, maybe someone can advise if I am missing something obvious. I went into the system settings for Fred and set all the items for sorting by “Name”. But when I go back to Fred, each time it defaults to sorting by…I have no idea. I guess it sorts by “Rank”? The Name column is never sorted alphabetically. At first I thought it was but in descending order (because I saw my Who Are We element at the top, but then all of a sudden an element named Button that I created before and was further down, now shows at the top.

I have to click on the Name column heading every time to get the sort to work when I go to the element editor.

Any advice? Or a bug? I would have thought that if this was a bug that someone smarter than I am would have seen it and put in for investigation!

MODX Revolution: 2.7.2-pl
Fred: fred-1.1.1-pl

I might be wrong here, but I could imagine the system settings are expecting either ASC, DESC or RAND() as an input. The general syntax is one of those two:

Option 1:   $query->sortby('DESC()');

Option 2:   $query->sortby('Name','ASC');

So the question is, whether or not you can define the column to sort by. I’m assuming if you put in ASC or DESC it works fine (probably sorting by ID then)?

Again this is just my understanding of things, I haven’t used FRED, so please don’t quote me, but I hope this might be helpful at least a little bit…

Bumping this up as this is still a problem. I had to go in and add two new elements to a client project and the new elements are pushed to the bottom of the list. I have what I think are the proper values for Fred to sort the column by the Name attribute as default in the system settings. It is like the interface is only sorting on the index number of the order in which elements were entered.

Still does not sort properly. Have to constantly click the Name column heading for sort. My client only has to make infrequent updates so I want this list to be sorted properly each time they log in. As they tend to not remember the sorting issue in between updates and will miss this new section. Resulting in them having to contact me to help.

Before I went live last year, I had to recreate the elements list in the exact alphabetical order as a hack so that it was listing properly.

Hoping this is an easy fix!

As far as I can see, these system settings only apply to the frontend.
The list in the manager (that you show in the screenshot) has a fixed default sort order of “rank ASC”. As the rank is always 0 in your case (according to the screenshot), the order isn’t clearly defined.
If you want to change the order of the elements, you can do this with either drag and drop in the grid. Or you can double-click the value in the column “Rank” and change it, or do a right-click -> “Update Element” and change the field “Rank” there.


Wow, I cannot understand how I didn’t think of that earlier! I guess I was so hung up on the Name column I got stubborn and tried to square peg-round hole brute force solution that solution!

Really do appreciate your prompt and detailed solution. I went ahead and ranked in increments of 10 so I have 9 slots in between each for any future adds.

This is the only client I have on MODX, so I do not spend a lot of time in MODX/FRED. I only do small web projects as side jobs to supplement my main income from my day job.

This is an excellent community for support. I just wish MODX would replace WordPress as a mainstream CMS!! :wink:

Thanks again and have a great day!

1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.