代码之家  ›  专栏  ›  技术社区  ›  luca

数据网格和水平滚动策略

  •  0
  • luca  · 技术社区  · 16 年前

    <?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周围,而不是整个应用程序上。

    2 回复  |  直到 16 年前
        1
  •  1
  •   Wouter Coekaerts    16 年前

    问题是 VBox 大于 Application ,即使设置了 width="100%" width="{width}" 在VBox上。

        2
  •  0
  •   jpgoulet    16 年前

    例如,如果datagrid是500像素宽的,并且您有250像素的多个列,那么您可以得到您要查找的滚动策略,如下所示:

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="500" layout="absolute" horizontalScrollPolicy="off">
        <mx:VBox >
            <mx:DataGrid width="500" horizontalScrollPolicy="on" >
                <mx:columns>
                        <mx:DataGridColumn headerText="a" width="250" />
                        <mx:DataGridColumn headerText="b" width="250" />
                        <mx:DataGridColumn headerText="c" width="250" />
                        <mx:DataGridColumn headerText="d" width="250" />
                        <mx:DataGridColumn headerText="e" width="250" />
                        <mx:DataGridColumn headerText="f" width="250" />
    
                </mx:columns>
            </mx:DataGrid>
        </mx:VBox>
    </mx:Application>
    

    即使列的总宽度大于datagrid,也可以这样做。