Expand-Collapse All Groups in SharePoint 2013 List Views using jQuery
SharePoint doesn’t have the ability to expand/collapse all groups in grouped list views. However, we can bring Expand All-Collapse All buttons in SharePoint 2013 grouped list views with jQuery. Just edit the grouped view page (Site Actions Gear >> Edit Page), add a “Script Editor” Web part and then place the below code in it.
jQuery for Expand-Collapse all items in grouped views in SharePoint
and here is the result:
Thanks to: https://www.nothingbutsharepoint.com/sites/eusp/pages/jquery-for-everyone-expandcollapse-all-groups.aspx for the idea!
22 thoughts on “Expand-Collapse All Groups in SharePoint 2013 List Views using jQuery”
Fantastic! Thank you!
Outstanding product, but I have one concern; it doesn’t work with web parts (or at least I can’t get it to). Any suggestions?
NM, I modified where the expand and collapse buttons get appended to, and put them with ms-list-addnew, and then chose full toolbar for the webpart. Now I’m tackeling the challenge of only applying this a singular webpart instead of all webparts because the code is conflicting with other code (Hillbilly’s Tabs). I tried using the code as a .js and using the JS Link but to no avail.
Can you help with targeting a specific web part on the page? I have 3 web parts on the page with groupings, and I want this to only expand and collapse the groupings of one web part.
How can I have this target one specific web part? I have 3 web parts on my page with groupings, and I just want this to work on one.
Works cool.. thank you . you are a hero!
Looks like the script worked well one level grouping, But if we have second level grouping then it breaks.
Thank you so much!! This article was really helpful. Best Regards,
This works great with Standard View.
It doesn’t work on Datasheet View though.
How do I make it work on Datasheet View?
I am using SharePoint 2013.
Expand-collapse on Datasheet view isn’t supported!
Thanks for your beautiful article. it works perfectly for SharePoint 2013 List. However it is not working for SharePoint 2013 Form library. do u have any break fix for this?
Just verified that it works on SharePoint 2013 Forms Library! Let me know what difficulty you are facing.
I have done all as suggested and it works great…..for me only? The buttons only appear on my screen and not on anyone else’s. Is this an permissions issue or is there something else causing it?
Should be a permission issue. Make sure All users can access the Script/Images!
i use it
perhaps control on view grouped or not, and hide in function
This works beautifully!
I wish you a good year 🙂
I have a questions: Unfortunately it doesn’t work for a gantview. Are they any possibilities to make it work? 🙂
Works great! Only issue so far is that the +/- sometimes disappear behind the “Find an item” box if there are multiple view tabs.
Wonderful!!!! Exactly what I was looking for – an updated expand/collapse script that could be used in Office 365. Thank you! If anyone else is like me and wants to get rid of the little underscore that shows up when you hover on one of the expand/collapse images, you can add a style attribute of text-decoration:none to the anchor tag.
Is there any way to show Totals when the groups are collapsed?
JT, You’ll have to modify Data view Web part’s XSL!
Thanks a lot worked like a charm …..