Sitecore Core Development

Tuesday, April 04, 2006

Sorting

On the major wishes on my list for 5.3 was sorting. The wish came in two flavors: the end-user should be able to drag/drop an item to change its sorting position and an item should be able to determine how it's children are sorted.

The good news is that both features have been implemented. The bad is news is... well there isn't any bad news (which is also good news).

To drag/drop an item to a new sorting position, the user should hold down the Alt key while dragging. There is no UI feedback for this unfortunately.

I have added a new field on the standard template called Subitems Sorting. This is a lookup box to /sitecore/system/Settings/Subitems Sorting. This item holds possible sortings, which is really just pointer to a .NET class, e.g. "Sitecore.Data.Comparers.DefaultSorting,Sitecore.Kernel".

This class must implement the IComparer interface, and we have provided a base class "Sitecore.Data.Compares.Comparer", if you want to use it. This architecture makes it possible to implement custom sortings besides the 5 basic sortings Sitecore provide: Default, DisplayName, Logical, Reverse and Updated.

When a user clicks the Subitems Sorting button in the Ribbon, she sees the following box:


There is a nice preview of how the sorting is going to look after it has been applied.

The ribbon also have a Reset Sorting options, that remove the explicit sort-order field on each subitem. This ensures that the sort-order field does not overrule the sorting set on the parent item.

0 Comments:

Post a Comment

<< Home