12

enter image description here

I have 4 views "All Documents" "Agreements" "Permits" "Deeds" I want to display all 4 of them above my document library but only 3 get displayed and the fourth gets placed in the "..." section. I believe this modification is possible through sharepoint designer, but I was curious if anyone knew how to achieve this through the web environment.

Thank you

19

Since you are using SharePoint 2013 I would recommend you to consider the following approach. In SharePoint 2013 was introduced a so called Client Rendering Mode (CSR) which is intended for rendering of List Views and Forms using HTML and JavaScript and which is a default rendering mode.

About View selector menu

As part of CSR ClientPivotControl control (clienttemplates.js) is intended for rendering View selector menu, SurfacedPivotCount property defines the amount of view menu options rendered horizontally (default value is 3)

How to display custom amount of view options for List View using CSR

The following template demonstrates how to override SurfacedPivotCount property in order to display 4 view menu options:

function renderHeaderTemplateForDocuments(renderCtx, fRenderHeaderColumnNames){
    var viewData = eval(renderCtx.ListSchema.ViewSelectorPivotMenuOptions);
    ClientPivotControl.prototype.SurfacedPivotCount = 4;   
    return RenderHeaderTemplate(renderCtx, fRenderHeaderColumnNames); //render default Header template
}

SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
  Templates: {
    Header: renderHeaderTemplateForDocuments
  }
});

How to apply the changes

There are at least two options how to apply the changes:

  1. Using JSLink property of XLV web part
  2. Place JavaScript template on page via Script Editor/Content Editor web parts

Here is how to apply the changes using the second option:

  1. Switch the page (NewForm.aspx) into edit mode
  2. Add Script Editor webpart right below the list view web part.
  3. Put the specified code by wrapping it using script tag code into the Script Editor, for example: <script type="text/javascript">{Template JS code goes here}</script>
  4. Save the page

Result

enter image description here

  • Sorry to comment on old discussion. May I know can I change the sorting order in view selector by CSR? – Mark L Nov 19 '15 at 3:46
  • 1
    @Mark, that sounds like a good question, would you mind to create a new question? – Vadim Gremyachev Nov 19 '15 at 7:38
  • 1
    @VadimGremyachev I posted new question here – Mark L Nov 20 '15 at 6:37
  • @Mark, i've posted an answer here – Vadim Gremyachev Nov 20 '15 at 14:41
  • @VadimGremyachev do you know if this is possible for discussion post replies (or indeed other areas where call outs are used)? I have posted a question here: sharepoint.stackexchange.com/questions/193071/… – Submits Sep 6 '16 at 11:09
6

I do not think that can be done. It shows the 4th view only once we click on it. (Dynamic HTML)

But I found a workaround.

  1. Go to Edit Page.
  2. Click on Add web part and add a content editor with the links to all 4 views.
  3. Edit list view web part and disable the view selector menu. Also if needed, set tool bar to no tool bar and remove search. (Look where to edit using screenshot)

enter image description here

  • Thank you, It seems like such a simple modification I figured there would be a way, but guess not... – jamalsabs Aug 20 '14 at 17:10
  • 1
    These html injection scripts are frustrating to customize – Christoffel de Gruyter Aug 20 '14 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.