Sabyasachi,
This is almost 5 years late but you can add this into a Script Editor above or below a list view. It will add a + or - to the right of the View menu. Clicking the + will expand groups.
- You might need to experiment with the jQuery version
- See the source comments mid way through to see where I got this
- I have used this in SP2013 and SP2019
<script src="https://code.jquery.com/jquery-3.7.1.min.js"
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="
crossorigin="anonymous"></script>
<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/advadd.png" width="15" height="15"></a>';
var collapseButton = "<a href='#' onClick="
+'"' + "this.href='javascript:collapseAll()'"
+ '"> <img title="expand all groups" style="border:none;" alt="collapse all" src="/_layouts/images/advminus.png" width="15" height="15"></a>';
$(document).ready(function () {
$(".ms-pivotControl-container").append(expandButton).append(collapseButton);
});
// Source: http://www.sharepointdiary.com/2014/07/expand-collapse-all-groups-in-sharepoint-2013-list-view-jquery.html
ExecuteOrDelayUntilScriptLoaded(overrideSurfacePivotCount, 'clienttemplates.js');
function overrideSurfacePivotCount() {
ClientPivotControl.prototype.SurfacedPivotCount = 10;
};
</script>