6/24/2009

SharePoint: Removing Group Headings from a View’s Group By

 

When you use grouping in list views SharePoint adds the somewhat redundant field name over and over again for each group heading.

image

Often the group field is pretty obvious. We really don’t need to see Color, Color, Color.

 

To fix this requires SharePoint Designer…

  1. Create the grouped view in the browser as usual
  2. Open the site in SharePoint Designer
  3. Find the view file: “yourname.aspx”
  4. Double-click the file to open it for editing
  5. Display the Code view of the file
  6. Search for GroupByField
  7. Delete all of this text:
    <GetVar Name="GroupByField" HTMLEncode="TRUE"/><HTML><![CDATA[</a> : ]]></HTML>
  8. Display the Design view and confirm that the change is what you wanted.
  9. Save the file
  10. Test in the site in the browser

Notes:

  • Make sure you get all of the text above, and no more.
  • This will remove all group by headings in the view. You can’t remove just one level.
  • Using SharePoint Designer is always at your own risk!  :-)
  • Remember that you can always right-click an edited file in the folder list and select “Reset to site definition” to undo all of your changes.
  • And finally, this is just a view. You can always delete it are start over.

 

The result should look like this:

image

 

.

9 comments:

David said...

I did a global search on the view page for the "GroupByField" field that you reference but I'm not able to find any references to it.

Mike Smith said...

David,

Did you setup a view with grouping, then do the search from within the Code view of the page (the grouped view) in SharePoint Designer? The GroupByField will not show up in the source of the page delivered to the browser.

Mike

Anonymous said...

Worked perfectly thanks for this post. I'm now trying to figure out if I can remove the count for the grouping...not needed and redundant. So far I'm not seeing the '(X)' as a separate value being called - might be part of the GroupByValue

Sarah said...

David,

Thank you! This works pretty slick.

I did notice that AFTER I make your suggested changes and if I go to make a change to the view, the groupbyfield field mysteriously reappears on the view but not in the code. Any tips on killing it completely?

Thanks!
Sarah

harithareddy8 said...

@Sarah,
I get the same problem. It did fix the problem the first time but later it came back but not present in the code view. Any ideas?

Cowgirl Kendra said...

I have used this trick so many times! Thank you for posting.

Kris Kristy said...

This is a good article and works. However, is there a powershell way to do this because I have 100's of views across different sites and libraries.

Anonymous said...

Mike, I tried to use your technique in our SharePoint 2013 environment. I cannot find the offending code that you say to delete. I searched within the Code view of the grouped by page in SharePoint Designer, as you mentioned in a comment to another post. Has something changed in SP 2013 that would make your technique obsolete? Thanks for any info.

Mike Smith said...


Anonymous,

I'm not surprised that it does not not work in 2013. Enough has changed in 2013 to break most of the customizations that worked in 2007 and 2010.

One day I need to revisit these customizations, there's only about 100 of them :-), and see if I can get them to work in 2013.

I now caution against customizations to 2013, especially Office 365, due to Microsoft's rate of change to the user interface.

Mike


Note to spammers...

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.