Sharepoint - How to display more than three views in SharePoint 2013

SP 2013 uses clienttemplates.js to create the those views control. You can either create a JSLink or add the following script using the script Editor webpart to the page where your list view resides.

<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(overrideSurfacePivotCount, 'clienttemplates.js');

function overrideSurfacePivotCount() {
   ClientPivotControl.prototype.SurfacedPivotCount = 4;
};
</script>

enter image description here

You can find more details about the ClientPivotControl and other rendering techniques in the 'clienttemplates.debug.js'


1) You can edit the page that contains each view (Site Actions > Edit Page) and then insert a Content Editor Web Part. Within this web part, you can add links to each of your views and format/style them as needed.

2) The property that controls the default value is hidden by the XsltListViewWebPart control, so unfortunately we can't modify it to be a value of >3.


Good hint about "ClientPivotControl" here, thanks!

However, inserting the above webpart script broke my CSS on list views for anonymous users so I found another workaround and thought I'd share it.

Basically, find all occurrences of variable "SurfacedPivotCount" in c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\ files and change it's values from default 2 or 3 to 6 (anything more than 3).

There will be 8 files to edit:

  1. clienttemplates.js
  2. clienttemplates.debug.js
  3. PivotControl.js
  4. PivotControl.debug.js
  5. search.analyticsrecommendation.js
  6. search.analyticsrecommendation.debug.js
  7. SP.UI.People.js
  8. SP.UI.People.debug.js

for example in SP.UI.People.debug.js in the line:

SP.UI.People.PeopleListViewPane.get_view().$Z_0.SurfacedPivotCount = 2;

change the value from 2 to 6.

Tags:

List

List View