+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / order list master view widget

order list master view widget

8 posts, 0 answered
  1. John Tolar
    John Tolar avatar
    87 posts
    Registered:
    07 May 2003
    16 Feb 2012
    Link to this post
    Is there a way to create a sort order on the list widget? I am creating a timeline of events on the Clay Tornado site (in staging currently) and I can set the order in the backend, but cannot find how to set the order on the front end.

    I would like to have the order set to date created to sho the timeline. Also, I ould love to set a detail view on the same page to the first list item without having to set the url manually.

    please see http://staging-clayrecovers.southernharmony.net/recovery/response-timeline for an example of what I am talking about

    Thanks,
    John
  2. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    17 Feb 2012
    Link to this post
    Hi John,

    By default you are able to create a custom sorting for a widget by editing the SortingExpression setting in the Control Defition -> Views section of the control. However there is no such setting, which we will investigate. In the meantime I can suggest you to create a new control in which you can inherit the functionality of the original control and apply some custom sorting of yours.

    Here is a quick code snippet which sorts pages instead of lists, which you can use as reference:

    App.WorkWith()
                      .Pages().ThatArePublished()
                      .LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend)
                       
                      .Get()
                      .ToList()
                      .OrderByDescending(pN => pN.LastModified)
                      .ToList();


    Kind regards,
    Victor Velev
    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
  3. John Tolar
    John Tolar avatar
    87 posts
    Registered:
    07 May 2003
    21 Feb 2012
    Link to this post
    okay,, I can inherit the ListItem control but what event do I need to override?
  4. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    23 Feb 2012
    Link to this post
    Hi John,

    You can override the InitializeControls event and add your custom logic there. I want to suggest to check the following blog post by my colleague who has provided an example of how to extend the built in functionality of our controls:

    http://www.sitefinity.com/blogs/stanislavvelikov/posts/12-01-23/how_to_add_additional_logic_into_sitefinity_built_in_widgets.aspx


    All the best,
    Victor Velev
    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
  5. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    23 Mar 2012
    Link to this post
    I am trying to setup a sort order on Telerik.Sitefinity.Modules.Lists.Web.UI.ListView

    I do not see InitializeControls as an option to override.
  6. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    23 Mar 2012
    Link to this post
    I am trying to setup a sort order on Telerik.Sitefinity.Modules.Lists.Web.UI.ListView

    I do not see InitializeControls as an option to override.
  7. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    27 Mar 2012
    Link to this post
    Hi Stacey,

    You can inherit ListItemsMasterView and override the InitializeControls method as shown in the attached screenshot.

    Regards,
    Victor Velev
    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
  8. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    27 Mar 2012
    Link to this post
    Can you give me a little more help.  Below is where I am at on the code.  

    1.) I am not even sure if what I have in the InitializeControls will even work.  Do I need to push it to ToList() like your pages example?
    2.) The immediate issue is I am trying to figure out how to setup a parameterless constructor.  I know I cannot have just base(null) as it has three parameters, but I cannot find the right way to do this..

    namespace SitefinityWebApp.Custom
    {
        public class CustomListItemsMasterView : Telerik.Sitefinity.Modules.Lists.Web.UI.ListItemsMasterView
        {
            protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition)
            {
                base.InitializeControls(container, definition);
     
                this.ListsControl.DataSource = this.GetLists().OrderByDescending(li => li.Title);
            }
     
            public CustomListItemsMasterView(ListViewMode mode, IEnumerable<Guid> listIdsToShow, Guid templateId) : base(mode, listIdsToShow, templateId)
            {
                 
            }
           
             
     
        }
    }

    I tried to add something like this in addition to the other constructor, but as I stated, I know it is not correct.
    public CustomListItemsMasterView()
                : base(null)
            {}



8 posts, 0 answered