SharePoint doesn't has the ability to expand/collapse all groups in grouped list views. However, with jQuery we can bring Expand All-Collapse All buttons in SharePoint 2013 grouped list views. 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 2013:
and here is the result:
Thanks to: https://www.nothingbutsharepoint.com/sites/eusp/pages/jquery-for-everyone-expandcollapse-all-groups.aspx for the idea!
Read more: http://www.sharepointdiary.com/2014/07/expand-collapse-all-groups-in-sharepoint-2013-list-view-jquery.html#ixzz3Re7hfmvU
jQuery for Expand-Collapse all items in grouped views in SharePoint 2013:
<script type=
"text/javascript"
>
function
expandAll() {
$(
"img.ms-commentexpand-icon"
).click();
}
function
collapseAll() {
$(
"img.ms-commentcollapse-icon"
).click();
}
var
expandButton =
"<a href='#' onClick="
+
'"'
+ "
this
.href=
'javascript:expandAll()'
"
+ '"
> <img title=
"expand all groups"
style=
"border:none;"
alt=
"expand all"
src=
"/_layouts/images/collapseplus.gif"
></a>';
var
collapseButton =
"<a href='#' onClick="
+
'"'
+ "
this
.href=
'javascript:collapseAll()'
"
+ '"
> <img title=
"expand all groups"
style=
"border:none;"
alt=
"collapse all"
src=
"/_layouts/images/collapseminus.gif"
></a>';
$(document).ready(
function
() {
$(
".ms-pivotControl-container"
).append(expandButton).append(collapseButton);
});
</script>
Thanks to: https://www.nothingbutsharepoint.com/sites/eusp/pages/jquery-for-everyone-expandcollapse-all-groups.aspx for the idea!
Read more: http://www.sharepointdiary.com/2014/07/expand-collapse-all-groups-in-sharepoint-2013-list-view-jquery.html#ixzz3Re7hfmvU
No comments:
Post a Comment