Image sort order in albums

Posted by Community Admin on 04-Aug-2018 21:48

Image sort order in albums

All Replies

Posted by Community Admin on 19-May-2011 00:00

I noticed in the backend that you are able reorder the images in a album. This is excellent that this feature is included and just what I am looking for. 

I cannot find the property in the Model.Image or Model.Album objects to get this value. Anyone know if this property is available in the API?

I am looking for something like:

var album = GetAlbumByName("Homepage Random Current Trip Images");
 
var images = album.Images.ToList().Where(image => image.Status == ContentLifecycleStatus.Live).OrderBy(image => image.XXX);

Thanks,

Solomon Shaffer

Posted by Community Admin on 20-May-2011 00:00

Hi Solomon,

We sort the image through service ImageService. Here is an example for sorting by Title.

Sitefinity/Services/Content/ImageService.svc/?managerType=&providerName=&itemType=Telerik.Sitefinity.Libraries.Model.Image&provider=&sortExpression=Title%20ASC&skip=0&take=50

You can use the following methods to make sorting

items = DataProviderBase.SetExpressions(items, filter, sortExpression, culture, skip, take, ref totalCount);

Best wishes,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 20-May-2011 00:00

Thanks for the quick reply. I can sort the list I get back using LINQ (by title or any other public property). I am looking for the order property that is assigned to a image when you reorder the images in an album (click on an album > Album Actions > Reorder Images). How do I sort my list in the order I specify in the backend?

Thanks!

Solomon Shaffer
Intrinsic Industries

Posted by Community Admin on 20-May-2011 00:00

@Solomon, you want to sort by the property "Ordinal" when you drag and drop images to set the sort order the value is stored in the Ordinal field.

Pretty sure that's what you are looking for.

Regards,
Phill

Posted by Community Admin on 20-May-2011 00:00

OK. Now I feel silly. That was it. Thanks, Phil!

Solomon Shaffer
Intrinsic Industries

Posted by Community Admin on 20-May-2011 00:00

Not a problem and not so silly, I spent some time looking for something called "SortOrder" as that seemed logical to me. Glad I could put you on the right track.

Cheers,
Phill

This thread is closed