Here's a generalisation of kguler's answer for OpenerView. It allows to handle tree-like structures.
Using the functions defined in my answer to Nested OpenerView controls not aligned you can emulate OpenerView controls that nest well (i.e are aligned, which is not possible using OpenerView because of the recursive way it's built, there's always an extra space in sub layers). You need to copy the code from the previous link before execting this code. This code deals more with the recursion on a tree rather than with the display which is now easily handled with openerView and OpenerTree.
ClearAll@grid;
grid[x_,color_:None]:=Grid[{x},Dividers->All,ItemSize->4,Background->color];
leafExpand[object_]:=
Module[{info,color},
info=getLeafInfo@object;
color=getLeafColor@object;
{
info
,
grid[info,color]
}
];
recursiveExpand[object_]:=
Module[{recursiveExpansion,results,displays,result,display,children,color},
children=getChildren@object;
recursiveExpansion=TreeExpand/@children;
color=getGroupColor@object;
results=recursiveExpansion[[All,1]];
displays=recursiveExpansion[[All,2]];
result=groupAggregationFunction@results;
display=openerView[grid[result,color],displays];
{result,display}
];
ExpandTree[x_,header_]:=Map[TreeExpand,x][[All,2]]//OpenerTree[#,header]&;
getChildren=#[[2]]&;
groupAggregationFunction=Total;
getGroupColor=First;
getLeafInfo={#[[2]],#[[2]]}&;
getLeafColor=First;
TreeExpand[o:oo[color_,info_]]^:=leafExpand[o]
TreeExpand[o:gg[color_,info_]]^:=recursiveExpand[o];
x={gg[Pink,{gg[Pink,{oo[LightBlue,1],oo[LightBlue,2],oo[LightBlue,3]}],oo[LightBlue,1],oo[LightBlue,2],oo[LightBlue,3],gg[Green,{oo[LightBlue,1],gg[Black,{oo[LightBlue,1],oo[LightBlue,2],oo[LightBlue,3]}],oo[LightBlue,2],oo[LightBlue,3]}]}]};
ExpandTree[x,grid@{"a","b"}]