数据网格中的 rowCount 不起作用

发布于 2024-11-03 08:28:22 字数 3380 浏览 1 评论 0 原文

我的代码

<?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 属性不起作用。在此代码中,显示的行数超过给定的限制。请指导我解决此问题。

my code is

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

in this the rowCount Property is not working. in this code the rows are displayed more than the given limit.please guide me on this probleml.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

反目相谮 2024-11-10 08:28:22

从 datagrid 标记中删除 height="100%" 将解决您的问题。

Removing height="100%" from the datagrid tag will fix your problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文