Yes this is possible. You can use some javascript to do that. Here is a post about this. http://alectang.com/blog/archive/2010/09/09/easy-expand-or-collapse-sharepoint-list-in-group-by-view.aspx
The trick is to find the little minus button and then click it:
function expandGroups() { $("img[src*='plus.gif']:visible").parent().click(); }
function expandGroups() {
$("img[src*='plus.gif']:visible").parent().click();
}