OPEN TO WORK

Available for new opportunities! Let's build something amazing together.

Changing the number of visible list views in the view selector of a list or library

JavaScript
post

This post is over a year old, some of this information may be out of date.

For a colleague I did some checks on how the view selector rendering is achieved in lists and libraries. While digging through the code I found a very useful property, which is the ClientPivotControl.prototype.SurfacedPivotCount property. This property is used to define the amount of list views that are visible on the list view selector.

The default property value is 3, which you can also check in all your lists and libraries. You always receive three view links, the other views can be accessed underneath in the list view menu (…):

Show image Default list view selector
Default list view selector
Show image List view selector menu
List view selector menu

Now by changing this property, for example to 6 in my example, all my list views become available:

Show image List view selector with 6 available views
List view selector with 6 available views

The code to achieve this fairly simple:

// With MDS enabled
ExecuteOrDelayUntilScriptLoaded(function () {
if (typeof ClientPivotControl.prototype.SurfacedPivotCount !== "undefined") {
ClientPivotControl.prototype.SurfacedPivotCount = 6;
}
}, "start.js");
// Without MDS
if (typeof ClientPivotControl.prototype.SurfacedPivotCount !== "undefined") {
ClientPivotControl.prototype.SurfacedPivotCount = 6;
}

Video

Video made by Webucator.

Related articles

Report issues or make changes on GitHub

Found a typo or issue in this article? Visit the GitHub repository to make changes or submit a bug report.

Comments

Elio Struyf

Solutions Architect & Developer Expert

Loading...

Let's build together

Manage content in VS Code

Present from VS Code