Section Editor sort by list label

5 posts by 2 authors in: Forums > CMS Builder
Last Post: April 22, 2013   (RSS)

By kitsguru - April 18, 2013


I have a table that has a list field (generated from another table). I want to sort the list page in the Builder by the list label. The list already displays the label. Clicking on the column title sorts the list by the value not the label This is somewhat counter intuitive as I would expect the column to sort by the displayed label not a hidden value. One might even consider this a bug. :)

Is there a way to control this in the Section Editor Sorting tab?

I don't have an issue with the viewer as I simply do a leftjoin and set my own order by there.

Jeff Shields

By Dave - April 19, 2013

Hi kitsguru, 

Unfortunately there's no way to change that currently.  The issue is that the way the codebase has evolved there's no support for automatic joins in the backend yet so those labels are being looked up after the mysql query has been completed.  It is something we want to add, but it's going to take some major rewriting.

We could write you a plugin to hide the sort link for that fieldname if you like (The plugin filter name is: listHeader_displayLabel) so at least it wasn't confusing.  

Sorry about that, let me know if there's anything else I can do to assist.  Thanks!

Dave Edis - Senior Developer

By kitsguru - April 19, 2013

Hi Dave,

Isnt the list sorted using javascript when you click on the column heading? Since you already have the value and label, it should be an easy patch.

Jeff Shields

By Dave - April 22, 2013

Hi kitsguru,

We could do that if there was so few records that they all appeared on one page, but for cases where there are many pages the entire resultset needs to be sorted.  Since that could be many thousands of records it needs to be done in MySQL.

There's no simple or elegant workaround for that one, unfortunately, but one "hack" that's possible is having a plugin that updates another text field with the label so that can be displayed and sorted.

Sorry I can't be of more help with that one.  

Dave Edis - Senior Developer