<s:Panel title="人员理科考试统计情况列表" width="100%" height="100%"> <mx:AdvancedDataGrid id="advancedGrid" designViewDataType="flat" top="10" bottom="10" left="10" right="10" selectionColor="#65A0F2" creationComplete="advancedGrid_creationCompleteHandler(event)" dataProvider="{selectLkksxxListCollection}"> <mx:columns> <mx:AdvancedDataGridColumn headerText="考试类别" dataField="KSLBM" /> <mx:AdvancedDataGridColumn headerText="考试人次" dataField="KSRS"/> <mx:AdvancedDataGridColumn headerText="合格人次" dataField="HGRS"/> <mx:AdvancedDataGridColumn headerText="合格率" dataField="RATIO"/> </mx:columns> </mx:AdvancedDataGrid>
以及
<mx:GroupingCollection2 id="selectLkksxxListCollection" source="{selectLkksxxListResult.lastResult}"> <mx:Grouping label="KSLBM"> <mx:GroupingField name="HY"> <mx:summaries> <mx:SummaryRow summaryPlacement="group"> <mx:fields> <mx:SummaryField2 dataField="KSRS" summaryOperation="SUM"/> <mx:SummaryField2 dataField="HGRS" summaryOperation="SUM"/> <mx:SummaryField2 dataField="RATIO" summaryOperation="aa"/> </mx:fields> </mx:SummaryRow> </mx:summaries> </mx:GroupingField> </mx:Grouping> </mx:GroupingCollection2>
按照HY分类,第一列的数据均为HY.
在panel中删除HY列则可.
页面计算ratio
<mx:AdvancedDataGridColumn headerText="考试人次" dataField="KSRS"/> <mx:AdvancedDataGridColumn headerText="合格人次" dataField="HGRS"/> <mx:AdvancedDataGridColumn headerText="合格率" dataField="RATIO" labelFunction="doRatio"/>
doRatio function为:
protected function doRatio(oItem:Object,iCol:AdvancedDataGridColumn): String { return String((oItem.HGRS/oItem.KSRS*100).toFixed(1)); }
即可