Change order for list view drop down
-
Wednesday, May 19, 2010 7:03 PM
I may be overlooking something obvious, but I have not been able to find an easy way to sort the views available in the view drop down for lists. We're migrating to 2010 from WSS 3.0 and currently, the view drop down is sorted alphabetically.
Help?
All Replies
-
Thursday, May 20, 2010 4:16 AMThere isn't a setting - it's alphabetical within the regions, which go in this order: Default, Personal, Public, Admin.
SharePoint Architect || Microsoft MVP || My Blog -
Thursday, May 20, 2010 2:14 PM
That is how the sorting has worked in WSS 3.0.
However, I have tested this in 2 environments and sorting appears to be by creation date/time rather than alphabetical:
1. Upgrading a WSS 3.0 site to 2010 Server via database attach method - copied wss_content, restored backup to overwrite an empty DB on the new 2010 farm SQL server, attached wss_content to web application using powershell mount-spcontentdatabase command.
An example of the sorting for views on one of the migrated lists...
Before migration:
All Invoices (History)
All Pending Invoices
Freight Forms
Glenda View
Lauara ViewAfter migration:
All Pending Invoices
Glenda View
Lauara View
Freight Forms
All Invoices (History)
2. A task list in a new site collection created from scratch in SP 2010, I created 3 new views using Standard View format. Views sort in this order:
Active Tasks
By Assigned To
By My Groups
Active Test
Active Test 1
Active Test 0 -
Thursday, May 20, 2010 4:31 PMMine are in alphabetical order.
SharePoint Architect || Microsoft MVP || My Blog -
Friday, May 21, 2010 12:25 AM
Which version of SharePoint 2010 do you have installed?
I am currently running x64 RTM SharePoint Server Enterprise Edition. I created the site collection using the default team site template. I find it hard to believe I'm the only one seeing this...
-
Friday, May 21, 2010 4:32 AMCarth, I just got home and went to check this out. When I intentionally make some new views that aren't in alphabetical order as I create them, then they do stay in the order of creation - no alphabetizing. I had not created enough views to notice they were in creation order, but I have now confirmed what you're seeing. I am on Enterprise RTM.
SharePoint Architect || Microsoft MVP || My Blog -
Friday, May 21, 2010 4:43 AM
Good to know at least I'm not the only one seeing this.
I've also noticed that the view groupings (Default, Personal, Public) only render for the view drop down displayed in the List or Library tab.
The view drop down displayed while browsing in a list or library appears to render without any useful cues (sorting or view type grouping).
This is also the case for pre-visual upgrade site list views.
-
Friday, August 06, 2010 10:14 PMI'm having the same issue and have googled for hours and can't find an answer on how to get it to go into order. Anyone have an answer yet?
-
Friday, August 06, 2010 10:30 PM
Well, I found out how to manually change the order, which is more of a pain that it doing it automatically... But, if you go to the home site, and go to Site Actions > Site Settings > Look and Feel > Top link bar you can change the order.
I accidently hit "Propose as Answer" instead of "Reply" OOOPSY!
-
Friday, August 06, 2010 10:38 PMYasmien, those settings aren't related to views. Views are within a list or library and aren't related to site navigation. Were you talking about the same topic?
SharePoint Architect || Microsoft MVP || My Blog -
Friday, August 20, 2010 10:20 PM
I think I put my answer in the wrong thread... oops
-
Wednesday, September 08, 2010 12:23 AM
Having the same issue too.
The views drop down seems to be based on the order created.
I have 20 seemingly randomly sorted view that looks terrible to end users without custom sorting.
I looked in Sharepoint Designer 2010 and couldn't find a way to sort either.
Has anyone found a solution? If not in an XSL file somewhere, maybe a work-around would be to prefix each list item with a number and then use jQuery to sort the drop-down menu view client-side?
-
Friday, September 17, 2010 2:05 PM
Same problem here (no surprise!), and I would really like for this basic and irritating problem to be solved. Anyone from MS care to comment on this?
-
Friday, October 01, 2010 2:37 PM
I've been trying to figure this one out for a while and found a way to reorder them, although it's probably not the "supported" method from Microsoft and it is by far not the prettiest. It involves actually editing data directly in the sharepoint content database but just a creation date, so nothing that is earth shattering. So get into your content database (default is WSS_Content unless you named it otherwise) and do the following.
Step 1:
Find the List ID in dbo.AllLists table for the list you want to reorder the views. The ID is stored in the tp_ID field and the display you can search by is in tp_Title. If you have to get a specific sub-site's list because you have multiple of the same name, you can get the tp_WebID value from the dbo.Webs table in the ID field (the SiteId field stores the top level site ID which can be found in the dbo.Sites table).Step 2:
Using that List ID, in the dbo.AllWebParts table, use the following SQL statement to pull all the views for the list:SELECT * FROM [WSS_Content].[dbo].[AllWebParts] WHERE tp_ListId = 'BIG LONG LIST ID HERE' AND tp_DisplayName <> '' AND tp_Deleted = 0 ORDER BY tp_CreationTime
Step 3:
Enter new dates in the tp_CreationTime field in the order you want the views to be shown. If the list was created from a template with views, all the dates are 1900-01-02 00:00:00.000, and a day added for each one, thus why this date obviously doesn't matter much to the system except for ordering because I would be mad if a date from 1900 showed up anywhere.Once these are changed, you can immediately go and refresh your list and your views on both the title line in the header and in the dropdown on the tool bar for the list and they will magically be in whatever order you put them.
Now...if only Microsoft had a better way to do this.
- Proposed As Answer by Jeff Betro Friday, October 01, 2010 2:37 PM
- Unproposed As Answer by Steven AndrewsEditor Wednesday, June 06, 2012 3:16 PM
-
Saturday, November 06, 2010 12:45 AM
Please do not modiffy the database directly. This puts your database in an unsupported state.
You can use the following power shell script to sort the views. You will need to replace the values in $webURL and $listName to match your environment. The values being the url of the site and the name of the list/library for which you need to sort the views. Please exercise caution when using this in production environment and ensure that you have tested it. This script re-creates a clone of each view and then deletes the view, but it does so in a sorted order. Views in SharePoint 2010, by default, are sorted by create date.
#Add-PSSnapin Microsoft.SharePoint.PowerShell
#Set the $ErrorActionPreference to "STOP" so that the script stops if there are any errors
$ErrorActionPreference = "STOP"
#Declare the constants
$webURL = "http://tehnoonr-ws08-4"
$listName = "newlistforcase"
#Create a sorted list to hold the views
$sortedList = new-object System.Collections.SortedList
$web = Get-SPWeb $webURL
$list = $web.Lists[$listName]
$views = $list.Views
#Go through all the views and add them to the sorted list, so that will automatically get sorted
foreach ($currentView in $list.Views)
{
$sortedList.Add($currentView.Title, $currentView.Title)
}#At this point we have all the views sorted in the $sortedList object. Let's delete each view and add it again.
foreach ($currentKey in $sortedList.Keys)
{
$viewToDelete = $list.Views[$currentKey]
#Add the new view
Write-Host "Cloning the view " $viewToDelete.Title
$newVew = $viewToDelete.Clone($viewToDelete.Title, $viewToDelete.RowLimit, $viewToDelete.Paged, $viewToDelete.DefaultView)
#Delete the old view only if new view got created
Write-Host "Deleting the view " $viewToDelete.Title
$list.Views.Delete($viewToDelete.ID)
}
#Set #ErrorActionPreference back to "Continue"
$ErrorActionPreference = "Continue"- Proposed As Answer by AtlSharePoint Tuesday, March 08, 2011 8:27 PM
-
Wednesday, February 09, 2011 5:12 PMWill this powershell script work for document libraries as well as lists?
-
Tuesday, March 08, 2011 8:26 PMThanks for the script. The only issue with it is it changes the web address of the view by adding a "1" to the aspx page. If a user has a link to the view they will get a 404 error because their shortcut will not have been updated.
-
Tuesday, March 15, 2011 5:26 PMIs this going to be fixed in the next patch? Why can't if i reconfigure the view for this location change the sort that way. I think that way users can sort the views the way they want.
-
Monday, May 16, 2011 4:55 PM
Can powershell scripts like this be executed from a workstation by a site collection admin or do they need to be executed on the sharepoint server?
Matt H. -
Friday, November 04, 2011 7:06 PM
I think that this addresses the topic under discussion, if not please point me to the correct topic.
In Sharepoint 2010 to have subsites listed in the order that you want in a fly-out or drop down menu rather than in alphabetical order there are two related methods that I’ve come across. A disclaimer, I’ve not found these documented anywhere so they may work now and not work with an update to Sharepoint. That is, it’s not clear whether these methods work as a consequence of a feature or something else.
Method One
As an example create the outer level site” Test” . Then create the following subsites to Test: One, Two, Three, Four. Assuming that you have “show subsites” selected in Navigation (Site Actions, Site Settings, Navigation) for Test, the sites will show in the following order in the flyout or drop down menu:
Four
One
Three
Two
Turn off “show subsites” and create links for One, Two, Three, and Four. In Navigation for Test you should see something like the following:
Libraries
Lists
Discussions
One
Two
Three
Four
Starting with the link for Four, use the “Move Down” to change link from being indented to not. Repeat this for Three, Two, and One. You should see something like the following:
Libraries
Lists
Discussions
One
Two
Three
Four
The fly-out for Test will now list the sites in the order: One, Two,Three, and Four. If there are no headings listed in Navigation, the links will not be indented.
Method Two
Follow the instructions for method one and then create another site at the same level as Test. For example, Temp. Select “Show Subsites” for Test. Go to the Test site, go to Site Actions, then Site Settings, then Content and structure. In Content and structure expand Test so that you see the sites One through Four. Select all of these sites and under Actions, Move the sites to Temp. The links that you created for One through Four should now point to Temp rather than test.
Next, while still in the context of Test (this seems to be critical) and in Content and structure, Move site One back to Test. After you’ve done that, select Site Settings for Test while in Content and structure. Select Navigation in Site Settings and check to make sure that the link for One points to Test rather than Temp. Click Ok and then select Content and structure while in the Site Settings for Test. Move site Two from Temp to Test and repeat the previous steps of selecting Site Settings for Test and checking in Navigation that the link for Two is correct. Again, click Ok to exit Navigation. Repeat these steps for site Three and Four. At the end of this process the fly-out for Test should look like the following:
Test
One
Two
Three
Four
One
Two
Three
Four
Remove the links for One through Four and you should see the following:
Test
One
Two
Three
Four
-
Friday, February 17, 2012 2:24 AM
This is an issue with the earlier versions of SharePoint 2010 and was fixed with Cummulative Update June 2011, though I recommend installing a later CU. See http://support.microsoft.com/kb/2536591 for details.
Items are now sorted alphabetically (as per MOSS and WS3.0) so you can use letter codes to get the right order e.g.:
a) View 1
b) View 2
etc
Jos Auker-Woor, MCTS, Technical Director, Information Leadership Ltd
- Proposed As Answer by Jos Auker-Woor Friday, February 17, 2012 2:24 AM
- Edited by Jos Auker-Woor Friday, February 17, 2012 2:27 AM
- Marked As Answer by Carthjr Friday, August 10, 2012 12:03 PM

