if i can add to matts suggestion.
i usually find one doLater() isn't enough so i tried your example
with the following change
public function populate():Void
{
    for (var i:Number = 0; i < largeArray.length; i++)
         largeArray[i] = {Number: i, TestColumn: 'a' + i};

  doLater(this, "scrollMe");
}
function scrollMe()
{
if(myGrid.maxVPosition == 0)
{
  doLater(this, "scrollMe")
}
else
{
  myGrid.vPosition = myGrid.maxVPosition;
}
}


--- In [email protected], Andriy Panas <[EMAIL PROTECTED]> wrote:
>
> Hello Matt,
>
> Thank you for commenting.
> We are using Flex 1.5.
>
> I must report that calling
> ---------------------
> myGrid.vPosition=maxVPosition
> ---------------------
> does not scroll dataGrid to the very end even after I tried to
apply "doLater()" or alternatevely "setInterval" to
> postpone the execution of this command.
>
>   Bizarre thing is that when I
call "myGrid.vPosition=maxVPosition" for
> a second time via hitting any button on the form, then the scroll
> position of Datagrid control is set correctly to the very end.
>
>
> The test code follows:
> ---------------------------------------------------
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
width="100%" childrenCreated="populate()">
> <mx:Script>
> <![CDATA[
>  import mx.controls.Alert;
>  public var largeArray = new Array(10000);
>  public var intervalId : Number;
>  public function populate():Void
>     {
>          
>      for (var i:Number = 0; i < largeArray.length; i++)
>         largeArray[i] = {Number: i, TestColumn: 'a' + i};
>     }    
>  
>   function scrollMe() {
>             //Alert.show(myGrid.maxVPosition);
>                 myGrid.vPosition = myGrid.maxVPosition;
>                 clearInterval(intervalId);
>                 delete intervalId;
>   }
>   function scrollDatagridInterval() {
>     intervalId = setInterval(this,
>         "scrollMe", 100);      
>   }
>   function scrollDatagridDoLater() {  
>         doLater(this, "scrollMe");
>   }
> ]]>
> </mx:Script>
> <mx:DataGrid id="myGrid" width="350" height="350"
dataProvider="{largeArray}" >  
>       <mx:columns>
>             <mx:Array>
>                        
>                <mx:DataGridColumn columnName="Number" />
>                <mx:DataGridColumn columnName="TestColumn" />
>             </mx:Array>
>       </mx:columns>     
>    </mx:DataGrid>   
> <mx:Button id="mybtn1" label="scroll DoLater"
click="scrollDatagridDoLater()"></mx:Button>
> <mx:Button id="mybtn2" label="scroll setInterval"
click="scrollDatagridInterval()"></mx:Button>
> </mx:Application>
> ---------------------------------------------------
>
> > In 1.5 setting vPosition=maxVPosition usually works, but you may
need to
> > do it in a doLater.
>
>
> --
> Best regards,
>  Andriy                            mailto:[EMAIL PROTECTED]
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to