Subscribe to our blog!

Subscribe
List and Detail view

Correlate master/detail views for multiple content widgets of the same type on the same page

  • List and Detail view
  • ContentViewDisplayMode
  • Build-in widgets
By on

Have you ever stumbled upon a scenario where a list of content items should be displayed while a detail view of another item of the same content type is displayed on the same page? For example purposes below, we will use the stock News widget.

Imagine we have a list of news items and “Featured” news on the right sidebar on the same page. The requirement is to keep the list of "Featured" news always visible while we preview each of the other news items details.

 

Lists of blogs and related blogs


By default in Sitefinity, once an item is opened in a detail view, the featured list also goes in detail view.


A list of blogs, sidebar is broken

 

 

If you are of those diligent developers, probably you already think about a simple user control which will always display the Featured list of news items by some criteria. However, you will be surprised that there’s a much straightforward way!

Note: A step by step guide of how to achieve it can be found in the end of this blogpost.

Fortunately, there is a property that could be accessed in the advanced designer of most of the Sitefinity OOTB content widgets, called “ContentViewDisplayMode”. The default value is “Automatic”.

We can set it to “Master” or “Details” instead. When set to “Master”, it will always display a list of items and will never display the detail view of a single item (and vice versa for Details).

 Stepping back to our example scenario, the best approach I can think of is to set the widget displaying the Featured items to “Master”. I would like to leave the Display mode of the list of news widget to Automatic, since I still want to use in its both states.

The Featured news widget will now always display a list of items and never go in detail mode.

The featured blog post is is now displaying a list


Pros and Cons +/-

Pros:

+ No code changes required (no deployment and respectively no down-time).
+ Can be done without the help of a developer, simply follow the step by step guide below.

Cons:

-If the page has to be recreated by content editors, It will be easier for them to simply drag and drop a custom widget rather than setup the build-In widget as described in this blog post.
 

Step by step guide:

Open the designer of the widget which should always display a list of items. (The widget is located on the detail view page if's a different one from the list view page. It might also be located on a template).

Find the widget designer 

Open the advanced widget designer:

Open the advanced widget designer 

 

Locate the “ContentViewDisplayMode” property and set the value to “Master”:

Change the ContentViewDisplayMode to Master

Summary:

To always keep a content widget in Master view, set it's ContentViewDisplayMode property to Master (accessible from Advanced widget designer). 

Always try to keep things as simple as possible! KISS 😉

 

Back To List

By continuing to use this website you are agreeing to its use of cookies. To find out more, please see our cookie policy.