Thursday, January 24, 2013

Moving View Dropdown for Sharepoint Lists

One of the annoying “features” of SharePoint 2007 is how the View dropdown gets pushed off of the page when working with list views with many columns.

 

Left part of the page:

Two scrolls to the right and we can now find the view menu:

View menu just to the right of the other toolbar buttons. (After Adding the Javascript)

 
Complete Steps:
  1. Display the list’s view page
  2. Click Site Actions, Edit Page
  3. Add a Content Editor Web Part and move it to the bottom of the page (below the list’s web part)
  4. Edit the Content Editor Web Part, click the Content Editor button and paste in the following JavaScript
  5. Save everything and test!
Javascript code:
<script>
var x = document.getElementsByTagName(“table”);
for (var i=0;i<x.length;i++)
{
// find the table with this class
if (x[i].className==”ms-menutoolbar”)
{
// change the widths of all of the cells to 0
for (var j=0; j<x[i].rows[0].cells.length;j++)
{
x[i].rows[0].cells[j].style.width=”0″
}
// change the width of the last column
x[i].rows[0].cells[j-1].style.width=”100%”
}
}
</script>

No comments:

Popular Posts

Disclaimer

The opinions expressed on this blog are the personal views of Pratik's SharePoint Blog, and do not represent or reflect the viewpoints or policies of any past, present, or future employer, colleague, or customer, or any other entity. The posts on this blog are provided ‘as is’ with no warranties, express or implied, and confer no rights. Use of information contained within this blog, including specific technical steps mentioned herein, is at your own risk. References to specific software products, processes, resources, or companies do not imply any endorsement.