More in this section

Forums / Developing with Sitefinity / Ordering News Items in News List

Ordering News Items in News List

8 posts, 0 answered
  1. JoanneC
    JoanneC avatar
    4 posts
    Registered:
    14 Sep 2006
    13 Jul 2007
    Link to this post
    I have a client who is using front-end side of the CMS to edit their site and wants to know if there is a way to change the order that news items appear in the news list.

    Right now the default seems to be oldest item at the bottom of the list with the newest item at the top. I don't know why they'd want to change this, but they do.

  2. Yasen
    Yasen avatar
    121 posts
    Registered:
    18 May 2013
    14 Jul 2007
    Link to this post
    Hello Joanne,

    You are able to sort news items in the news list by one of the fields listed in web.config file, section: telerik -> cmsEngine -> MetaFields.

    For those fields there is a "sortable" property. By default for news the following fields are avaiable, they are all set as sortable:
    Title, Summary, Author, Source, Publication_Date, Expiration_Date, Thumbnail.

    To sort the news list items you have to:

    1. Add a news list control on a page,
    2. Click on edit in the top right corner,
    3. In Appearance section modify the SortBy field.

    You can choose between Ascending and Descending order by adding "ASC" or "DESC". For example if you want to sort news by publication date in descending order , you should type "Publication_Date DESC" in the SortBy field. (Note that the name is case-sensitive)

    We should also apologize for this small bug you may encounter: When you type in the SortBy field a name that doesn't exist you get a "no such name" message. After that the control may act weird so you have to re-add (delete and then add) it.

    Sincerely yours,

    Yasen
    the Telerik team


    Instantly find answers to your questions at the new Telerik Support Center
  3. Jim Aderhold
    Jim Aderhold avatar
    48 posts
    Registered:
    29 Feb 2004
    19 Jul 2007
    Link to this post
    I was wondering how you would do a sort by the Publication_Date when you have multiple entries on the same date. Since the Date is being converted over to a varchar when added to the database, it is not carrying over the time stamp which would allow you to sort by the Publication_Date with multiple date entries. When I view my entries, they all show a time stamp of 12:00 am. What I am trying to achieve is to only list the top three entries. I know I can adjust the number of entries to be displayed, but the order was the issue.
  4. Bob
    Bob avatar
    330 posts
    Registered:
    30 Dec 2016
    19 Jul 2007
    Link to this post
    Hi Jim,

    Why do you think Publication_Date field is saved as varchar? By default it is saved as datetime. Your entries always show with 12:00 timestamp because they are entered like that. To enable time you have to set appropriately RadDatePicker control in ControlPanelInsert.ascx and ControlPanelEdit.ascx templates located in ~/Sitefinity/Admin/ControlTemplates/ folder.

    Greetings,
    Bob
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Jim Aderhold
    Jim Aderhold avatar
    48 posts
    Registered:
    29 Feb 2004
    19 Jul 2007
    Link to this post
    In the sf_VrsTxtData, the value for the column DataImpl is set to nvarchar(max). I was assuming the data was being stored in this table. I should have researched this more before I made the assumption. I see that in the sf_CmsContentMetaData that the values are being stored correctly. I apologize for the assumption.

    I will look into changing the DateTime fields over to a RadDatePicker to control the timestamp. Thanks for the information.
  6. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    Registered:
    18 May 2013
    20 Jul 2007
    Link to this post
    Hello Jim Aderhold,

    You can change the RadDatePicker declaration to RadDateTimePicker very easily. From this:

    <radC:RadDatePicker ID="Publication_Date" runat="server"></radC:RadDatePicker>

    to this:

    <radC:RadDateTimePicker ID="Publication_Date" runat="server"></radC:RadDateTimePicker>

    Sincerely yours,

    Vassil Daskalov
    the Telerik team


    Instantly find answers to your questions at the new Telerik Support Center
  7. Jim Aderhold
    Jim Aderhold avatar
    48 posts
    Registered:
    29 Feb 2004
    13 Mar 2008
    Link to this post
    Is the limitation of only sorting by one field by design? When I try to sort by say "Publication_Date DESC, Title" I get a "The given key was not present in the dictionary." error.

    Thanks,
    Eric
  8. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    14 Mar 2008
    Link to this post
    Hello Jim,

    We do not support ordering by more than one column for the time being. Still, we have plans to implement this functionality for future release.

    We are sorry for the inconvenience caused.


    Best wishes,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
8 posts, 0 answered