order list master view widget

Posted by Community Admin on 03-Aug-2018 20:11

order list master view widget

All Replies

Posted by Community Admin on 16-Feb-2012 00:00

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

Posted by Community Admin on 17-Feb-2012 00:00

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

Posted by Community Admin on 21-Feb-2012 00:00

okay,, I can inherit the ListItem control but what event do I need to override?

Posted by Community Admin on 23-Feb-2012 00:00

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:

www.sitefinity.com/.../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

Posted by Community Admin on 23-Mar-2012 00:00

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.

Posted by Community Admin on 23-Mar-2012 00:00

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.

Posted by Community Admin on 27-Mar-2012 00:00

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

Posted by Community Admin on 27-Mar-2012 00:00

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)
        



This thread is closed