Image sort order in albums
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);
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
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
@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
OK. Now I feel silly. That was it. Thanks, Phil!
Solomon Shaffer
Intrinsic Industries
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