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

查看:18
本文介绍了flex 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天全站免登陆