flex datagrid - 制作网格高度动态和包含它的组件 [英] flex datagrid - making grid height dynamic and component that contains it

查看:123
本文介绍了flex datagrid - 制作网格高度动态和包含它的组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我想构建一个具有动态高度值的数据网格,因为行数总是不同。我还想将高度传达给整个组件,以便它也随着datagrid而增长。任何人都可以帮助我最好的方式来创建这样一个动态的数据网格。

i want to build a datagrid which will have a dynamic height value because the number of rows will always be different. I also want to communicate the height back to the component holiding it so that it also grows with the datagrid. Can anyone help me out on the best way to create such a dynamic datagrid.

感谢

推荐答案

DataGrid的高度由 rowCount 属性。如果您希望DataGrid始终足​​够高以显示所有包含的元素(例如,将其包装在一个Scroller中,以处理DataGrid对于可用空间太大的情况,而不是使DataGrid本身滚动),只需将其绑定到数据源的相应属性:

The DataGrid's height is controlled by its rowCount property. If you want your DataGrid to always be exactly high enough to show all the contained elements (and, for example, wrap it inside a Scroller to handle the situation where the DataGrid is too big for the available space, rather than having the DataGrid itself scroll), simply bind it to an appropriate property of your data source:

<mx:DataGrid dataProvider="{myData}" rowCount="{myData.length}"/>
<fx:Script>
    <![CDATA[
        import mx.collections.ArrayCollection;

        protected var myData:ArrayCollection;
    ]]>
</fx:Script>

这篇关于flex datagrid - 制作网格高度动态和包含它的组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆