Custom sort field for manual sortingCancel

Are there any ideas on creating a way for an admin to set the sort order for a list of documents in a library?
I have tried this: creating a custom field where they can enter a number for the order.
However, there may be 3 out of the 10 files they want listed on top then the rest ordered by their Name.

I followed all instructions for changes in webconfig and maping of templates. I have made the custom filed an integer and also tried short text. Not sure which is a better solution.
I am using the LibraryItemList.ascx for the Admin view of the list, LibraryItemEdit.ascx for the item edit view, and DownlistListTableMode.ascx for the front end view.
Also, how do i sort the listing of the documents in the admin side (LibraryItemList.ascx ) to be the Custom Field "SortOrder" first then if blank (actually it says 'undefined'), finish sorting by the Name of the document. In addition, sometimes (every third click of hte column heading) when clicking on the Sort Order column in the grid, the rows with 'undefined' fields disappear!

Inside library item list there is a function DataBindGrid where you have to add your custom metakey to the array of requiredMetaFields. Then we call GetContentItems where you can pass your metakey as sortExpressionsAsSQL to filter the RadGrid. To avoid missing rows when you have not set a value for SortOrder you need to use an empty string or just set a default value for the SortOrder - for instance "0"

Regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote

In the client side lisitng such as in the DownloadListTableMode.ascx, is it possible to sort my the metafield and then if there are a remaining list of items with say "0" they are ordered by Title? Is that possible? I have read that multiple column sorting is not possible...

eh, i thought i got it working... it looked like it because i did a batch edit, but anyhow, how can I control the sort order precedence? In the Admin side as well as the front end view? Like order by Sort Order first then if value is "0" order by the Title after all the items with numbers > 0 are listed. ???

Since it is a shorttext field, i made the defaut value the text "by title" then it will list the numbered ones first. However I need to have the second sort order by the Title. I have read that you can't have more than one sort. Is that true?

You cannot pass two parameters for SortExpression inside GetContent method and this is the reason why you cannot sort by two parameters. You need a custom web service where you manipulate the list of items with LINQ and its methods OrderBy, OrderByDescending, OrderBy and ThenBy

Regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items

Sitefinity 4.0 allows you to make custom sorting in a library by several parameters. Please check attached screenshot.

Regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items

Sorry to bring this thread back to life, but the sort order metafield (or Ordinal as i named it) will not work if it is text.

it will not sort correctly. It has to be an integer... i have changed this to an integer in the web.config and made all empty fields a 0. The sorting seems to be working now.

However, when i go to edit, the text box for Sort Order is blank for the 0's and also if i try to update it or update one with a number already in it, it throws this error below so I am obviously missing something here with the textbox in the (**edit to post**) LibraryItemEdit.ascx control. ??? Thank you!

Cannot cast System.Int32 to string. The metadata field Ordinal can accept only the following data types: string.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Cannot cast System.Int32 to string. The metadata field Ordinal can accept only the following data types: string.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidCastException: Cannot cast System.Int32 to string. The metadata field Ordinal can accept only the following data types: string.]

The metadata field type should be updated in the database. This is set in [sf_GCMetaData] where you will find a column ValueType.

If the value is

0, this means that the type is ShortText
1, this means that the type is LongText
2, this means that the type is DateTime
3, this means that the type is Integer.

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

Webinars

Tools

Progress, Telerik, Sitefinity and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries.