读书人

求教高手,NumericStepper 作为itemren

发布时间: 2013-01-05 15:20:39 作者: rapoo

求教高手,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>


我的需求是,从数据源中取出daizuo 属性,作为最大值和当前值. 可是有问题,麻烦大哥们帮忙一下,先谢过了,小弟学flex不久,折腾一晚上了
[解决办法]
这个很简单,自己多实践下就可以了。

<?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>




<?xml version="1.0" encoding="utf-8"?>
<s:MXAdvancedDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
focusEnabled="true">

<s:NumericStepper value="{Number(listData.label)}" minimum="1" maximum="{Number(listData.label)}" stepSize="1"/>
</s:MXAdvancedDataGridItemRenderer>

读书人网 >flex

热点推荐