3

I have an issue in Sharepoint 2013. This is the situation. You create a (wiki)page that shows the web part of a list (in my case a calendar list). If you edit the web part, you get the option to select another list view from a drop-down menu titled 'Selected View' (marked in red in the image below). Normally this works fine, but if you have too many list views on the same list, it seems the drop-down menu only shows a limited amount (in my case 47 custom made views and 5 of the standard views). Is there a possibility to show all possible list view in the drop-down or to select the desired view in any other way?

Any help is deeply appreciated.

Screen shot of the list view selector

1

I've not encountered this issue before, but I don't think I've encountered a list with over 50 public views either.

You may also want to consider just using either a content query web part or search webpart and customize your view from there. You then have flexibility in using XSLT or display templates. You can still link back to the actual calendar list view for users that want to use the published view types.

Back to your specific request. One method I can think of is setting it via PowerShell

Disclaimer: I pulled this together from some older scripts I had but have not had a change to validate it directly - may need slight adjustments.

 $web = Get-SPWeb "https://<My Site URL>"  #web where page lives   
 $page = $web.GetFile("Pages/default.aspx")  #page where webpart lives
 $page.CheckOut()  
 $webpartmanager = $web.GetLimitedWebPartManager("Pages/default.aspx", [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)    

for($count=0;$count -lt $webpartmanager.WebParts.Count;$count++)  {   

    if($webpartmanager.WebParts[$count].title -eq "Calendar"){    #change this to your webpart title
        $wp=$webpartmanager.WebParts[$count];  
        $wp.ViewId=<view ID number>;  
        $webpartmanager.SaveChanges($wp);  
        break;   
    }   
}

$page.CheckIn("Relevant Articles")  
$page.Publish("Relevant Articles")  
$web.Update();   
$web.Dispose();  

You should be able to get reference to your webpart and export the ID's available, the trick part is correlating them back to your actual list view page.

  • Let me briefly explain what the list contains. The list is actually a reservation calendar for a bunch of devices. It has a column that contains the name of the instrument (which is a lookup column based on a list with instrument names). Each view I made for the list, basically shows the list items filtered for a specific instrument. So I guess this should be possible through a query, though I'm not sure how... I'm also not familiar with PowerShell. Is there anything in javascript that would do the trick as well? – Giovanni Vleminckx Aug 21 '15 at 9:27
0

It seems that the List View Web Part is limited to 50 views appearing in the Selected View drop-down field. See the Tech Net discussion thread Dashboard (web part) pages - cannot add view to web part and also see Not all views being displayed in my web part. It sounds like this limit is not well-documented, though.

You can use the Edit the current view to create the view you'd like to show in the List View Web Part on-the-fly, but obviously this isn't as convenient as being able to select the view you already created.

  • Such a shame that there isn't a more convenient workaround ... At the moment, it seems the on-the-fly made views will be my only option. According to the answer by @jshelbyjr it could be done through PowerShell, but as I have no experience with this, I'll postpone a bit to see whether anybody else has an idea. Otherwise, I'll have to stick with your solution I'm afraid. – Giovanni Vleminckx Aug 21 '15 at 13:46
0

Another possible work-around if all you are displaying on the wiki page is the filtered view of the list:

You could instead use some URL hacking to link to a single view of the list, but filtered for the device value. You can get an idea of what the URL should be if you go to the view, filter the device column from the column header, and then use the URL generated. It will look something like this:

http://yourserver/sites/yoursite/Lists/yourlist/AllItems.aspx#InplviewHash48c2b48d-18df-4b25-bc3c-0e94bcd91266=InitialTabId%3DRibbon%252ERead-VisibilityContext%3DWSSTabPersistence-FilterField1%3DDevice-FilterValue1%3DSample%2520Name

Once you have the first one, you just need to change the FilterValue attribute for each device.

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.