Yes, you are correct I was not doing that properly...

I have modified the code so now my columns are correct...But for any
grouped column the data is not displaying...For an ungrouped column
the data shows...I am assuming the issue is in the dataField property
of my GroupedColumn...But not sure how to fix it...

Here is the new code...

rawArray = JSON.decode(rawData) as Array;
Storesdp = new ArrayCollection(rawArray);
var colArray:Array = new Array();
var oColumnDef:AdvancedDataGridColumn;
var oColumnDef_amt:AdvancedDataGridColumn;
var oColumnDef_cnt:AdvancedDataGridColumn;
var columnGroups:ArrayCollection = new ArrayCollection(); 
                                
                                
oColumnDef = new AdvancedDataGridColumn();
oColumnDef.headerText = "Operations Report";
oColumnDef.dataField = "ld";
oColumnDef.width = 135;
oColumnDef.sortable = true;
oColumnDef.visible = true;
oColumnDef.editable = false;
oColumnDef.wordWrap = false;
                                        columnGroups.addItem(oColumnDef);
                                
var length : int = Storesdp.length;
for( var i : int = 0; i < length; i++ ) {
var columns:ArrayCollection = new ArrayCollection(); 
oColumnDef_amt = new AdvancedDataGridColumn();
oColumnDef_amt.headerText = "Amount"
oColumnDef_amt.dataField = "S"+Storesdp.getItemAt(i).data+"_amt";
oColumnDef_amt.width = 80;
oColumnDef_amt.sortable = true;
oColumnDef_amt.visible = true;
oColumnDef_amt.editable = false;
oColumnDef_amt.wordWrap = false;
oColumnDef_amt.labelFunction = amtLabelFunction;              
oColumnDef_amt.setStyle("textAlign","right");
                                        
columns.addItem(oColumnDef_amt); 

oColumnDef_cnt = new AdvancedDataGridColumn();
oColumnDef_cnt.headerText = "Count";                            
oColumnDef_cnt.dataField
="S"+Storesdp.getItemAt(i).data+"_cnt";
oColumnDef_cnt.width = 60;
oColumnDef_cnt.sortable = true;
oColumnDef_cnt.visible = true;
oColumnDef_cnt.editable = false;
oColumnDef_cnt.wordWrap = false;
                                        
oColumnDef_cnt.setStyle("textAlign","right");
                                                                        
columns.addItem(oColumnDef_cnt); 
                                        
var columnGroup:AdvancedDataGridColumnGroup=new
AdvancedDataGridColumnGroup(String(i));
                                                
columnGroup.headerText=Storesdp.getItemAt(i).label;
columnGroup.children = columns.source;
columnGroups.addItem(columnGroup); 
                                        
}

adg.groupedColumns = columnGroups.source

Reply via email to