I don't know if this is the most elegant solution, but it worked somewhat.

I still think there must be a way for the underlying dataProvider to change without triggering a redraw of all the scrollbar navigation elements. I thought I read somewhere that you can turn off the redraw on update to a data component, but I can't seem to locate that property again.

anyway, until I find it, here is my solution:

DEFINE A VARIABLE TO HOLD THE CURRENT SCROLL POSITION

public var userScrollPos:Number;

ASSIGN FUNCTIONS TO THE DATAGRID EVENTS

//this will initiate the database update when item editing is done
itemEditEnd="updateDataField(event)"

IN THE updateDataField FUNCTION SAVE THE CURRENT SCROLL POSITION
userScrollPos = dgDisplay.verticalScrollPosition;

//this will restore the scroll position when the dataProvider update is complete
updateComplete="restorePos()"

ON THE updateComplete EVENT RETORE THE SCROLL POSITION

public function restorePos(){
                dgDisplay.verticalScrollPosition = userScrollPos;
        }


If anyone finds a better way to do this, please let me know.

Thanks, Kevin




On Nov 23, 2006, at 12:40 AM, Kevin Merritt wrote:

I tried this and can't get it to work. Do you have an example of this in use? The usual properties & methods i am used to don't exist any more!


thanks, Kevin


On Nov 22, 2006, at 4:00 PM, Tracy Spratt wrote:


I think you’ll just have to record the selectedIndex in a variable and then set selectedIndex = that variable after data reload.



Tracy



From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Merritt
Sent: Wednesday, November 22, 2006 2:46 PM
To: [email protected]
Subject: [flexcoders] DataProviders & DataGrid Scroll Locations



Is there a way to update a DataProvider while keeping the scroll
location of the DataGrid that it binds to. Everytime I reload the
data provider, the scroll location goes back up to the first item.

- Kevin







Reply via email to