Flex 4 - Spark DataGrid上没有滚动条

时间:2014-03-20 09:05:56

标签: flex flex4

我必须在我的应用程序中显示很多控件。我使用完成了它。

    <s:Group clipAndEnableScrolling="true" >
    <s:Scroller horizontalScrollPolicy="auto" verticalScrollPolicy="auto" top="0" bottom="0" right="0" left="0">
        <s:Group clipAndEnableScrolling="true" >

            <s:layout>
                <s:VerticalLayout paddingTop="30" paddingLeft="20" paddingRight="20"/>
            </s:layout>

            <s:HGroup horizontalAlign="left" verticalAlign="top">
                <s:Button id="clearButton" label="Clear"/>      
                <s:Button id="addEmployee" label="Add"/>
            </s:HGroup>

            <s:HGroup horizontalAlign="left" verticalAlign="top">
                <s:Label id="mainLabel" text="Employee Details"/>
            </s:HGroup>

            <s:HGroup horizontalAlign="left" verticalAlign="top">
                       // some more components 
            </s:HGroup>
            <s:HGroup horizontalAlign="left" verticalAlign="top">
                <s:DataGrid id="grid">
                       // Grid column
                </s:DataGrid>
            </s:HGroup>
            <s:HGroup horizontalAlign="left" verticalAlign="top">
                <s:DataGrid id="dataGrid">
                       // Grid column
                </s:DataGrid>
            </s:HGroup>
        </s:Group>
    </s:Scroller>
</s:Group>

对于此代码,Grop和DataGrid都没有滚动条。我对这个卷轴没什么了解。如何在其中添加滚动条?或者我如何安排我的组件?

2 个答案:

答案 0 :(得分:1)

您的小组似乎没有设置宽度或高度,而是设置了顶部,右侧,底部和左侧。我假设它不会根据内容触发滚动条。

限制滚动条组件的尺寸(宽度和高度),并确保组的内容大于滚动条。

另外,您可以指定&#34; viewport&#34;在滚动条上并传入组内的id。 视口的默认值为null。

参考:http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/Scroller.html

-AJ

答案 1 :(得分:1)

首先,您必须为组容器滚动条设置高度宽度属性。比你必须设置

  

verticalScrollPolicy =&#34;上&#34; horizo​​ntalScrollPolicy =&#34;上&#34;

DataGrid

在这里,滚动条之前不需要Group。