tags:

views:

152

answers:

1

I am working on a grid example in flex using advanced grid control. I know we can easily group data by specifying the field name.

At the group node level, other than the gorup name I want to be able to show data in the rest of the cells ( calculated data ) and I am looking for some dataRowBound event or similar to be able to hook some data in it.

Example: Grid displaying list of towns grouped by state. At the group level ( for each state) I want to show the total number of towns in each state. Here how can i show the total number in the town column.

+1  A: 

You can do this by providing the data like this

<trade TrdId="Trade 1 o" col="0xCC9999" cmenu="YNYNYNYNYNYNYNY" AgreementId="1234">     
 <trade TrdId="Trade 1.1" col="0xCC9999" cmenu="YNYNYNYNYNYNYNY" AgreementId="1234">           
 </trade>          
 <trade TrdId="Trade 1.2"col="0xCC9999" cmenu="YYYYYYYYNYNYYYY" AgreementId="1234">        
 </trade>          
</trade>

And adding columns which read this data like

advancedDataGridColumn.dataField="@TrdId"

so on...

protected override function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void{
           var XMLdata:XML=rowNumberToData(dataIndex) as XML;

           if(XMLdata!=null){    
                 if(XMLdata.attribute(Constants.col) != undefined && XMLdata.attribute(Constants.col) != ""){
                color=XMLdata.attribute(Constants.col);     
                 }else{
                  color=0xFFFFFF;
                 }               
           }         
           super.drawRowBackground(s,rowIndex,y,height,color,dataIndex);      
     }

this is best method to get data out of grid and do some processing...

Rahul Garg