Developer forum

Forum » Feature requests » Item list loops - SortBy tag or select in the backend!

Item list loops - SortBy tag or select in the backend!

Jacob Storgaard Jensen
Reply

When having an item list loop, it would be great, if we in the template could start the loop with something like:

<!--@LoopStart(Item.Contacts)-->
<!--@SortBy(Item.Contacts.Name)-->
<!--@SortOrder(Ascending)-->
THEN THE ACTUAL LOOPED ELEMENT CODE HERE
<!--@LoopEnd(Item.Contacts)-->


It's a real pain to have to sort the items manually in the backend.

Would actually also be great to be able to pick in the backend, which field to sort by (or which FIELDS - plural - first by name, then by zip-code etc.), and in which order. Should be on the actual page item or paragraph item (and set the defaults when creating the item list in the Management Center!)


Replies

 
Nicolai Høeg Pedersen
Reply

Good idea. Maybe a general sorting mechanism on the Loop element?

 

Or you can just go to Razor, and sort there....

 

BR Nicolai

 
Jacob Storgaard Jensen
Reply

I know Razor is the way to go for a lot of things, but right now I can't pull more than 24 hours a day ;-)

 

But an option in the backend, to choose what to sort by and which order would make it much more flexible (for the backend user that is)

 

BR Jacob

 
Nicolai Høeg Pedersen
Reply

Hi Jacob

 

You have the option to select a field to sort by and the direction, see attachment. Or do you mean something else?

 

BR Nicolai

itempublisher.PNG
 
Jacob Storgaard Jensen
Reply

Hi Nicolai,

you do have that option when using the item publisher, but if you've got an item list on an item, you can't sort the items other than manually... :-) Would be great with the option to click the header of the column on which you want to sort, which then would result in that being the frontend sort order too...

 

 
Nicolai Høeg Pedersen
Reply

Hi Jacob

 

I've added a request to make it possible to choose on the field definition on the item type which field to sort by and the sort order, TFS#13926.

 

BR Nicolai