数据网格和水平滚动策略
看一下这段代码:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" horizontalScrollPolicy="off">
<mx:VBox horizontalScrollPolicy="on" width="100%">
<mx:DataGrid>
<mx:columns>
<mx:DataGridColumn width="5000" />
</mx:columns>
</mx:DataGrid>
</mx:VBox>
</mx:Application>
数据网格超出了我的屏幕范围,但滚动条毫无用处。 为了向您展示我的意思,请查看此处的编译输出: http://dl.dropbox.com/u/1663633/prova.swf
有什么想法吗?当然,这是一个简单的示例,我的现实生活文件要复杂得多,滚动条必须位于 dataGrid 周围,而不是整个应用程序上。
look at this code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" horizontalScrollPolicy="off">
<mx:VBox horizontalScrollPolicy="on" width="100%">
<mx:DataGrid>
<mx:columns>
<mx:DataGridColumn width="5000" />
</mx:columns>
</mx:DataGrid>
</mx:VBox>
</mx:Application>
The datagrid is outside the limits of my screen, but the scrollbar is useless..
To show you what I mean, look at the compiled output here:
http://dl.dropbox.com/u/1663633/prova.swf
Any Idea? Of course this is a simple example, my real life file is much more complex and the scrollbar MUST be just around the dataGrid, not on the whole application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题是
VBox
比Application
大,即使您设置了width="100%"
也是如此。我不清楚为什么它会出现这样的行为,但您可以通过在 VBox 上使用width="{width}"
来强制它与应用程序的大小相同。The problem is the
VBox
is bigger than theApplication
, even when you setwidth="100%"
. It's not clear to me why it (mis)behaves like that, but you can force it to be the same size as the Application by usingwidth="{width}"
on the VBox.数据网格的布局引擎无法处理比数据网格本身更宽的列。对于小于数据网格的列,您不会遇到此问题。
例如,如果数据网格的宽度为 500 像素,并且您有多个 250 像素的列,则可以获得您正在寻找的滚动策略,如下所示:
即使列的总宽度大于数据网格,这也将起作用。
The layout engine for the datagrid is not able to handle a column wider than the datagrid itself. You will not have this problem with columns smaller than the datagrid.
For example, if the datagrid is 500 pixels wide and you have multiple columns of 250 pixels, you can get the scrolling policy you were looking for like this:
This will work even if the total width of the columns is larger than the datagrid.