I added a collectionChange event to my XMLListCollection (that's the 
dataProvider for the grid) as follows:


public function preserveScrollPosition(event:CollectionEvent):void {
                                
var prevIndex:int = this.dgDelays.verticalScrollPosition;
trace("prevIndex = ",prevIndex);
this.dgDelays.scrollToIndex(prevIndex);

}

and the trace info does give me the value of the currentScroll, but 
the grid still goes back to the top after the data is populated.

is refresh() still being called after this guy?

--- In flexcoders@yahoogroups.com, "Deepa Subramaniam" 
<[EMAIL PROTECTED]> wrote:
>
> When the actual data comes in, the DataGrid encounters a REFRESH
> collectionChange event and if you look in
> ListBase.collectionChangeHandler's REFRESH case, you'll see that 
the
> verticalScrollPosition is set to 0. 
> 
> What you need to do is set the scroll position *after* the data 
has come
> in and the DataGrid has processed the REFRESH event. 
> 
> -deepa
> 
> -----Original Message-----
> From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
> Behalf Of djbrown_rotonews
> Sent: Tuesday, June 27, 2006 12:42 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Keeping DataGrid from scrolling to top on
> update to dataProvider
> 
> I actually tried this (my dataProvider for the grid is an 
> XMLListCollection being populated by a jsp. The grid has custom 
item 
> renderers if that's relevant).
> 
> anyhow, I have an "update" button which will call the jsp and get 
> new results when clicked. I've set it up so the click() method 
> correctly captures the scroll position, calls the jsp, and then 
sets 
> the scrollToIndex to the previous value of the scroll position. It 
> works great while the "busy cursor" is displayed, but it reverts 
> back to scrolled all the way at the top once the actual data comes 
> in from the jsp (it takes about 3 seconds to update the grid with 
> the new data).
> 
> any ideas on where the scroll position is being reset?
> 
> --- In flexcoders@yahoogroups.com, "Deepa Subramaniam" 
> <dsubrama@> wrote:
> >
> > Hi Jordan -
> > 
> >  
> > 
> > You can keep track of the verticalScrollPosition property in your
> > DataGrid and upon receving UPDATES, re-set the 
> verticalScrollPosition to
> > the previous value and the DataGrid will jump to the last scroll
> > position and show the correct content. 
> > 
> >  
> > 
> > -deepa
> > 
> >  
> > 
> > ________________________________
> > 
> > From: flexcoders@yahoogroups.com 
> [mailto:[EMAIL PROTECTED] On
> > Behalf Of Jordan Snyder
> > Sent: Monday, June 26, 2006 7:34 PM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Keeping DataGrid from scrolling to top on 
> update
> > to dataProvider
> > 
> >  
> > 
> > Hello All,
> > 
> > I am working on an app in which I poll the server quite 
frequently 
> to
> > get new information.  The information comes to me in an XML 
format 
> that
> > I simply assign as the dataProvider for a DataGrid component. 
> > 
> > I have to keep in consideration the fact that the user may have 
> selected
> > a certain row, and may want to delete that row even after an 
> update to
> > the dataProvider is made, so I keep track of the selectedIndex 
> property
> > and reselect upon an update.
> > 
> > But if the user has not selected a row, the DataGrid will 
> automatically
> > scroll to the top upon an update, even if the user has scrolled 
to 
> the
> > bottom of the grid.  
> > 
> > Is there a way around this?  I found a way to scrollToIndex(), 
but 
> no
> > way of getting the currently viewed items.  It may have 
something 
> to do
> > with the various renderer properties available on the DataGrid, 
> but I
> > have a very limited understanding of this, so it's over my head.
> > 
> > Surely this problem has been run into before, but I can't seem 
to 
> find
> > the right combination of search terms to figure out a method of 
> solving
> > it.
> > 
> > Does anyone have any ideas or proven methods for the problem?  
Any 
> help
> > would be greatly appreciated.
> > 
> > Thank you,
> > 
> > Jordan Snyder
> > jordan.snyder@
> > www.jordansnyder.com
> >
> 
> 
> 
> 
> 
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: 
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> Yahoo! Groups Links
>







------------------------ Yahoo! Groups Sponsor --------------------~--> 
Great things are happening at Yahoo! Groups.  See the new email design.
http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to