求教高手,NumericStepper 作为itemrenderer 内存上溢
代码如下,麻烦高手给试运行一下:
<?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" minWidth="955" minHeight="600"> <s:layout> <s:BasicLayout/> </s:layout> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] public var dgArray:ArrayCollection = new ArrayCollection([ {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:10}, {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:2}, {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4}, {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4}, {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4}, {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4} ]); ]]> </fx:Script> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> </fx:Declarations> <mx:AdvancedDataGrid dataProvider="{dgArray}" width="400" height="400"> <mx:columns> <mx:AdvancedDataGridColumn headerText="ceshi" dataField="daizuo"> <mx:itemRenderer> <fx:Component> <mx:NumericStepper value="{data.daizuo}" minimum="1" maximum="{data.daizuo}" stepSize="1" > </mx:NumericStepper> </fx:Component> </mx:itemRenderer> </mx:AdvancedDataGridColumn> </mx:columns> </mx:AdvancedDataGrid></s:Application>
<?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" minWidth="955" minHeight="600"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> </fx:Declarations> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] public var dgArray:ArrayCollection = new ArrayCollection([ {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:10}, {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:2}, {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4}, {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4}, {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4}, {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4} ]); ]]> </fx:Script> <mx:AdvancedDataGrid dataProvider="{dgArray}" width="400" height="400"> <mx:columns> <mx:AdvancedDataGridColumn headerText="ceshi" dataField="daizuo" itemRenderer="NumberCustom"> </mx:AdvancedDataGridColumn> </mx:columns> </mx:AdvancedDataGrid></s:Application>