Insert the following code in a Content Editor Web Part to display +/- icons to expand/collapse Items in a SharePoint List. The icons will appear in the Actions Menu in the List.
function collapseGroups() {
$("img[src='/_layouts/images/minus.gif']:visible").parent().click();
}
function expandGroups() {
$("img[src='/_layouts/images/plus.gif']:visible").parent().click();
}
$(function() {
var expandAll = "<a href='#' onClick="
+'"'+"this.href='javascript:expandGroups()'"
+'"><img title="expand all groups" style="border:none;" alt="expand all" src="/_layouts/images/collapseplus.gif"></a>';
var collapseAll = "<a href='#' onClick="+'"'
+"this.href='javascript:collapseGroups()'"
+'"><img title="collapse all groups" style="border:none;" alt="collapse all" src="/_layouts/images/collapseminus.gif"></a>';
$("td.ms-toolbar[width='99%']").append(expandAll).append(collapseAll);
});
</script>
1 comment:
In SP2010, there is no actions menu on a list or doclib. It's necessary to add an href to the script to display links on the page for the user to click.
Post a Comment