Flex DataGrid 列宽:一列统治所有?
我有一个 Flex 4,mx:DataGrid,设置了以下(相关)属性:
width="100%"
horizontalScrollPolicy="off"
我在所有 DataGridColumns
上设置了 minWidth
,并在其中之一设置了宽度。如果我只是最大化/最小化应用程序的显示(在浏览器或独立的 Flash 播放器中),则列可以很好地缩放。但是,如果您抓住应用程序的边缘并将其拖动以使其变大,则只有一列会变大。当您再次向下拖动尺寸时,一列仍然很大,但所有其他列都会被压扁。
这是 Flex DataGrid 中的错误,还是我只是缺少一个要设置的关键属性(或数据网格列上的属性),以便在拖动放大应用程序时使所有列增大和缩小?
I have a Flex 4, mx:DataGrid with the following (pertinent) properties set:
width="100%"
horizontalScrollPolicy="off"
I have the minWidth
set on all of the DataGridColumns
and the width set on one of them. If I simply maximize/minimize the display (in browser or stand-alone flash player) of the application, the columns scale up and down nicely. But if you grab the edge of the application and drag it to make it bigger, only one column grows really big. When you drag the size down again, the one column remains big, but all of the other columns get squished way down.
Is this a bug in the Flex DataGrid, or am I just missing a key property (or properties on the datagrid columns) to set, to make all columns grow and shrink when you drag-enlarge the app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Flex 处理数据网格的方式即使不是真正的错误,也是一个令人不快的异常现象。 Adobe 辩称,弄清楚如何调整所有列的大小似乎并不是一项简单的任务。
我一直处理这个问题的方法是在末尾创建一个虚拟列,其 minWidth 为 4 并且没有宽度规范。然后它就成为填补空缺的“可扩展列”。然后,我通过为每个列指定一个 minWidth 和一个宽度,确保从一开始就为其余列提供足够的空间来显示其数据和标题渲染器。我遇到的唯一问题是,如果在允许的空间内显示太多列,在这种情况下,您会得到一个水平滚动条,并且所有(或大多数)赌注都会关闭。
It is an unpleasant anomaly, if not an actual bug, in the way Flex does datagrids. In Adobe's defense, figuring out how to resize all the columns appears not to be a trivial task.
The way I've always handled this is to make a dummy column at the end, with a minWidth of 4 and no width specification. Then that becomes the "expandable column" that takes up the slack. Then I make sure to allow the rest of the columns enough room to display their data and their header renderers from the start by giving each a minWidth and a width. The only time I have problems is if there are too many columns to display in the space allowed, in which case you get a horizontal scrollbar and all (or most) bets are off.
解决这个问题的方法如下:
在creationComplete中添加
Solved this problem as follows:
in creationComplete add
尝试捕获事件,将horizontalScrollPolicy设置为On,让Flex自行调整列的大小,然后将horizontalScrollPolicy设置回Off
Try capturing the event, setting the horizontalScrollPolicy to On, letting Flex resize the columns itself, then setting horizontalScrollPolicy back to Off