customGroupFormat - title not being shown

Hi,

I am doing a groupby on column 0 (which is hidden) and use customGroupFormat to show the value of column 3 as group title.
The problem is, it always shows the value of hidden field (column 0) on the title initially. If I expand or collapse the group, it shows the correct title - which is the value of column 1.

Here is


mygrid_customerResults.setColumnHidden(0,true);
mygrid_customerResults.setColumnHidden(1,true);
mygrid_customerResults.groupBy(1,["","","","#title","","","","","","","","","","#stat_total","","","",""]);
mygrid_customerResults.customGroupFormat=function(name,count){	
			return AddCustomerNameToHeader(name,mygrid_customerResults);
}

function AddCustomerNameToHeader(name,grid){
    var newname;
	grid.forEachRowInGroup(name,function(id){
		var level = grid.cells(id, 0);
		var levelValue=level.getValue();
		
		if(levelValue == "1"){
   			var cell = grid.cells(id, 3);
   			newname = cell.getValue();
   		}
	});
	//alert(newname);
	return newname;
}	

I need to show the groups “expanded” initially… I am able to see the correct title only if I add these lines - which adds significant performance overhead on IE 7 at least…

mygrid_customerResults.collapseAllGroups(); mygrid_customerResults.expandAllGroups();

Can you please help?

mygrid_customerResults.setColumnHidden(0,true);
mygrid_customerResults.setColumnHidden(1,true);
mygrid_customerResults.customGroupFormat=function(name,count){   
         return AddCustomerNameToHeader(name,mygrid_customerResults);
mygrid_customerResults.groupBy(1,["","","","#title","","","","","","","","","","#stat_total","","","",""]);

The above code works… The only difference is I do the groupBy, after I define the customGroupFormat.