This article describes the view constraint you get out of the box with a Document Set in SharePoint. How we can enable multiple views to empower our end users. And how we can set the focus on a Web Part within a page.
Switching between views in Document Sets is particularly useful when the default view is grouped by a column which results in the Quick Edit/Datasheet View feature to be disabled.
The Document Set single view constraint
Enabling multiple views in a Document Set
How to focus the new Web Part
An alternative way
A Document Set is a group of related documents that you can manage as a single entity. You can create a Document Set in a single step, and then define its characteristics and metadata which can then populate through to the documents in the collection. Learn more about what you can do with a Document Sets
When you add the Document Set content type to a library it will inherit the default view of that library. The view is set in the Document Set Settings Welcome Page View section.
We can change this welcome page view by navigating to Document Library Settings > Select the Document Set Content Type > Click Document Set Settings link > Scroll to the Welcome Page View section
This allows you to have one default view at a library level and a different view inside the Document Set. The Welcome Page View is used for all instances of the Document Set. With multiple Document Set content types in a library you can specify a different view for each one.
What it looks like
When browsing the below document library the ‘a) Recently Modified’ view is set as default
Navigating into the Document Set switches the view so that we can present the properties in a relevant way.
You will notice from the screenshot that I no longer have the ability to change views.
Furthermore, because I am grouping by Document Type, I can no longer Quick Edit the contents of this Document Set.
Not being able to quick edit makes it challenging to bulk update metadata when dragging multiple files into the library.
To enable multiple views in a Document Set is actually quite simple. I discovered this primarily because I was tasked to update multiple libraries with an alternative solution that involved using Workflow. To save time and frustration I came up with the below.
Please note that you have edited the Welcome Page for all Document Sets in the library. You do not need to do this for every Document Set.
Now we can now select different views on the Document Set.
When selecting a view, the view page is loaded filtered by the Document Set.
There is a slight drawback with this method. When browsing the contents of the Document Set, the Library ribbon does not show by default.
The reason for this is that there are multiple Web Parts on the page. On page load SharePoint does not know which Web Part to focus on and so doesn’t. If we select the Web Part the ribbon will load as above. The original Document Set Contents Web Part is special in that it steals the focus on load.
We can set the focus automatically by using some JavaScript as detailed below.
Focusing a Web Part on page load is useful to show the relating ribbon tools. The focus is lost when there are multiple Web Parts per page.
This step involves adding a Script Editor Web Part to the Document Set Welcome Page with the following
<script type="text/javascript"> setTimeout(function () { // Grab the 4th Web Part elem = document.getElementById("MSOZoneCell_WebPartWPQ4"); if (elem != null) { dummyevent = new Array(); dummyevent["target"] = elem; dummyevent["srcElement"] = elem; WpClick(dummyevent); } // Update the name of the first view to Current View document.getElementById('WPQ4_ListTitleViewSelectorMenu_Container_surfaceopt0').innerText="Current View"; // Adjust the time to suit }, 400); </script>
Alternatively you can upload this as a txt file to Site Assets library of the Site Collection.
Then you can add a Content Editor Web Part with the content link to the txt file.
This will save you having to paste the same code for each library. Be sure to set the Chrome Type to none.
The alternative way provides a way to filter a library view by Document Set contents. It does not allow the ability to change the view from within a Document Set. So for the user experience it is not so intuitive.
The Document Set Name property cannot be set as a Shared Column. However if we create a second name column on the Document Set we could use workflow to populate it.
This second name column can then be used as a Shared Column on the Document Set.
Setting shared columns populates the property through to the documents in the collection.
Then you could set up library views with the new name property. This will enable end users to filter documents by this value. These views require documents to be shown outside of folders and may breach the list view threshold on the library. The end user will need to navigate out of the Document Set to select the appropriate library view.
Using a simple SharePoint 2010 workflow to achieve this may not be the best idea when considering future upgrades.
0 Comments
Hi, thanks for the article. It works fine the first time the page loads, My Document set loads the welcome page and default to the view selected as default. I can also see all the other views that I have created for the document library. However, when I click on any of those views, it “loses” the welcome page. The document set have the correct data, but looks exactly like the document library page.
Yep, that’s how it works. The view is loaded with out the Welcome Page data but the Library is filtered by the Document Set. Is great way to show the content in different ways and allows Quick Edit if your default view is grouped.