Fixing GroupBy List Views in SharePoint 2010 with SharePoint Designer

You may run into a problem with getting your list views to work in SharePoint 2010 if you keep your old 2007 look and feel.  Their are several articles out there that show you how to fix it programmatically, but not as an end user.

The problem is with list views that have a "Group by" added and the default XML in the CAML query is set to "TRUE" for the Collapsed attribute.  Here are the steps to fix this:

  1. You can open the view page you created for the list in SharePoint designer
  2. Do a search for "GroupBy" in the page ASP.NET code.
  3. Set the Collapse property to "FALSE"
  4. Add the following Javascript to the page to "Click" the links to collapse the elements:

<script language="javascript" type="text/javascript">               

ExpLinkFormer = function()
{
this._init();
}

ExpLinkFormer.prototype = {
_init: function() {

var links = document.links;

for (var i = 0; i < links.length; i++) {          
if (links[i].href == "javascript:" && links[i].onclick.toString().indexOf("ExpCollGroup") > -1) {
links[i].click();
}
}
}
}   
      
var expLnk = new ExpLinkFormer();
   
</script>

  • Save the page – problem solved!
  • Repeat for all the views that have the problem

Enjoy!

Chris