zoukankan      html  css  js  c++  java
  • Flex 学习笔记 Datagrid中选中某行时光标定位

    当Datagrid数据多时会出现滚动条,设置selectedIndex位置后,滚动条并不能根据Datagrid选中行的位置进行偏移。

    这时候可使用verticalScrollPosition属性

    AS:
        protected function btn_clickHandler(event:MouseEvent):void
                {
                    dgComplaints.selectedIndex=int(txt.text);
                    dgComplaints.verticalScrollPosition=dgComplaints.selectedIndex;
                }


    MXML:
    <s:TextInput id="txt"/>
        <s:Button label="定位" id="btn" click="btn_clickHandler(event)"/>
        <mx:DataGrid id="dgComplaints" height="100"> 
            <mx:dataProvider>
                <s:ArrayList>
                    <fx:Object
                        <fx:Artist>Pavement</fx:Artist> 
                        <fx:Price>11.99</fx:Price> 
                        <fx:Album>Slanted and Enchanted</fx:Album> 
                    </fx:Object> 
                    <fx:Object
                        <fx:Artist>Pavement1</fx:Artist> 
                        <fx:Price>9.99</fx:Price> 
                        <fx:Album>Brighten the Corners</fx:Album> 
                    </fx:Object> 
                    <fx:Object
                        <fx:Artist>Pavement2</fx:Artist> 
                        <fx:Price>11.99</fx:Price> 
                        <fx:Album>Brighten the Corners</fx:Album> 
                    </fx:Object> 
                    <fx:Object
                        <fx:Artist>Pavement3</fx:Artist> 
                        <fx:Price>11.99</fx:Price> 
                        <fx:Album>Slanted and Enchanted</fx:Album> 
                    </fx:Object> 
                    <fx:Object
                        <fx:Artist>Pavement4</fx:Artist> 
                        <fx:Price>9.99</fx:Price> 
                        <fx:Album>Brighten the Corners</fx:Album> 
                    </fx:Object> 
                    <fx:Object
                        <fx:Artist>Pavement5</fx:Artist> 
                        <fx:Price>11.99</fx:Price> 
                        <fx:Album>Brighten the Corners</fx:Album> 
                    </fx:Object> 
                    <fx:Object
                        <fx:Artist>Pavement6</fx:Artist> 
                        <fx:Price>11.99</fx:Price> 
                        <fx:Album>Slanted and Enchanted</fx:Album> 
                    </fx:Object> 
                    <fx:Object
                        <fx:Artist>Pavement7</fx:Artist> 
                        <fx:Price>9.99</fx:Price> 
                        <fx:Album>Brighten the Corners</fx:Album> 
                    </fx:Object> 
                    <fx:Object
                        <fx:Artist>Pavement8</fx:Artist> 
                        <fx:Price>11.99</fx:Price> 
                        <fx:Album>Brighten the Corners</fx:Album> 
                    </fx:Object> 
                </s:ArrayList>             
            </mx:dataProvider>
            
            <mx:columns>
                <mx:DataGridColumn dataField="Artist" />
                <mx:DataGridColumn dataField="Price" />
                <mx:DataGridColumn dataField="Album" />
            </mx:columns>
        </mx:DataGrid>
  • 相关阅读:
    (感受)新人生的三种境界
    (学)如何在打印时对横向页面重复左端标题
    (原)解决.NET 32位程序运行在64位操作系统下的兼容性问题
    (原)儿子上小学了
    OSG学习过程中的笔记
    从c++角度学习JAVA、Android的总结
    Android Studio利用cmakelists.txt编译OSG的方法总结
    android studio 利用gradle和cmakelist生成c++静态库.a的方法总结
    Android Studio使用c++静态库的方法总结(hello-libs为例)
    Android.mk、CMake、Gradle简介 NDK和JNI的关系
  • 原文地址:https://www.cnblogs.com/Anlycp/p/2567307.html
Copyright © 2011-2022 走看看