adobe flex auto scroll data in datagrid collectionChange

adobe flex auto scroll data in datagrid collectionChange

Postby haretu » Tue Mar 22, 2011 11:41 am

Adobe flex

This example shows how to auto scroll data in datagrid through setingverticalScrollPosition and maxVerticalScrollPosition properties in collectionChange event.
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mx:Application name="DataGrid_maxVerticalScrollPosition_text"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init();" viewSourceURL="srcview/index.html">

    <mx:Script>
        <![CDATA[
            import mx.events.CollectionEvent;
            private var timer:Timer;

            private function init():void {
                timer = new Timer(500);
                timer.addEventListener(TimerEvent.TIMER, onTimer);
                timer.start();
            }

            private function onTimer(evt:TimerEvent):void {
                var now:String = new Date().toTimeString();
                arrColl.addItem({id:timer.currentCount, time:now});
            }

            private function arrColl_collectionChange(evt:CollectionEvent):void {
                callLater(autoScrollDataGrid);
            }

            private function autoScrollDataGrid():void {
                if (dataGrid) {
                    dataGrid.validateNow();
                    dataGrid.verticalScrollPosition = dataGrid.maxVerticalScrollPosition;
                }
            }
        ]]>
    </mx:Script>

haretu
 
Posts: 132
Joined: Sat Jan 08, 2011 9:56 pm

Return to Adobe FLEX Flash

Who is online

Users browsing this forum: No registered users and 2 guests

cron