1. Background of the problem
In general. The ratio shown in the table. The control rate is handled by preserving two decimal places and keeping them up
2. Implementation examples
<?XML version= "1.0" encoding= "Utf-8"? ><s:application xmlns:fx= "http://ns.adobe.com/mxml/2009" xmlns:s= "library ://ns.adobe.com/flex/spark "xmlns:mx=" library://ns.adobe.com/flex/mx "width=" 100% "height=" 100% "fontSize=" "Font family= "Microsoft Jas Black" ><s:layout><s:basiclayout/></s:layout><fx:script><! [Cdata[import Mx.collections.arraycollection;import mx.events.flexevent;[ bindable]//table Data Binding private var gridarray:arraycollection = new ArrayCollection ([{week: "Monday", Apple: "3676", Rate: "0.7868 "},{week: Tuesday", Apple: "4534", Rate: "0.65454"},{week: "Wednesday", Apple: "6758", Rate: "0.876454"},{week: "Thursday", Apple: "9808" , Rate: "0.34224"},{week: "Friday", Apple: "6567", Rate: "0.9876523"},{week: "Saturday", Apple: "9000", Rate: "0.566777"},{week: " Sunday ", Apple:" 4533 ", Rate:" 0.988787 "}]);/** * Formats the ratios in tables */private function Formatdatagrid (item:object,column:d Atagridcolumn): String{var temp:number = Item.rate;var data:string = Dataformatter.format (temp); return data;}]] ></fx:script><fx:declarations><!--formatted digital--><mx:numberformatter id= "Dataformatter" precision= "2" rounding= "Up"/></fx:d Eclarations><mx:vbox width= "100%" height= "100%" paddingbottom= "ten" paddingleft= "paddingright=" 20 " paddingtop= "horizontalalign=" center "><mx:datagrid id=" DataGrid "width=" 100% "height=" 90% "dataprovider=" { Gridarray} "textalign=" center "><mx:columns><mx:datagridcolumn headertext=" Week "datafield=" Week "/> <mx:datagridcolumn headertext= "Apple" datafield= "apple"/><mx:datagridcolumn headertext= "ratio" dataField= "rate" labelfunction= "Formatdatagrid"/></mx:columns></mx:datagrid></mx:vbox></s:application >
3. Achieve Results
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvew91mjnoywk0nq==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center "width=" 710 "height=" 378 "border=" 1 ">
Flex column numeric value in a tabular format