order list master view widget
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
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();
okay,, I can inherit the ListItem control but what event do I need to override?
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
I am trying to setup a sort order on Telerik.Sitefinity.Modules.Lists.Web.UI.ListView
I am trying to setup a sort order on Telerik.Sitefinity.Modules.Lists.Web.UI.ListView
Hi Stacey,
You can inherit ListItemsMasterView and override the InitializeControls method as shown in the attached screenshot.
Regards,
Victor Velev
the Telerik team
Can you give me a little more help. Below is where I am at on the code.
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)
public
CustomListItemsMasterView()
:
base
(
null
)