我的代码是
<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark" xmlns= "*" >
<fx:Script>
<![CDATA[
]]>
</fx:Script>
<fx:Declarations>
<s:ArrayList id="arrList1">
<fx:Object name="Adobe Illustrator CS5" />
<fx:Object name="Adobe AIR 2.0" />
<fx:Object name="ColdFusion 9" />
<fx:Object name="Dreamweaver CS5" />
<fx:Object name="Flash Professional CS5" />
<fx:Object name="Adobe Flash Player 10.1" />
<fx:Object name="Fireworks CS5" />
<fx:Object name="Flex 4.0" />
<fx:Object name="Lightroom 2.0" />
<fx:Object name="Photoshop CS5" />
</s:ArrayList>
</fx:Declarations>
<s:Panel title="DataGrid Control Example" height="100%" width="100%">
<s:Label width="100%" color="blue" text="Select a row in the DataGrid control."/>
<mx:DataGrid id="dg" width="100%" height="100%" rowCount="5" dataProvider="{arrList1}">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="Name"/>
<mx:DataGridColumn dataField="name" headerText="Phone"/>
<mx:DataGridColumn dataField="name" headerText="Email"/>
<mx:DataGridColumn headerText="Select" >
<mx:itemRenderer>
<fx:Component>
<s:MXDataGridItemRenderer>
<s:DropDownList labelField="name">
<s:dataProvider>
<s:ArrayList id="arrList">
<fx:Object name="Adobe Illustrator CS5" />
<fx:Object name="Adobe AIR 2.0" />
<fx:Object name="ColdFusion 9" />
<fx:Object name="Dreamweaver CS5" />
<fx:Object name="Flash Professional CS5" />
<fx:Object name="Adobe Flash Player 10.1" />
<fx:Object name="Fireworks CS5" />
<fx:Object name="Flex 4.0" />
<fx:Object name="Lightroom 2.0" />
<fx:Object name="Photoshop CS5" />
</s:ArrayList>
</s:dataProvider>
</s:DropDownList >
</s:MXDataGridItemRenderer>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</s:Panel>
</s:Application>
在这个rowCount属性不起作用。在这段代码中,行的显示次数超过了给定的限制。请指导我解决这个问题。
答案 0 :(得分:0)
从datagrid标记中删除height="100%"
将解决您的问题。