I'm working on my first ever AIR application with flashbuilder - just so you know.
I've bound a mx:DataGrid
component to a DataProvider
which is a mx:HTTPService
fetching an xml file with items. To keep the data up to data I'm polling the webservice on a given interval.
My problem is that I loose the currently selected item in my DataGrid when the data is updated. I've tried to save the DataGrid.selectedIndex
and set when the data is updated, but I'm not sure when to do it?! The closest I've come is to restore the index when the updateComplete
event of DataGrid is fired. This works, but the selection first fades away and then fades in - not updated soon enough.
So what is the best way to keep the selection? (only one selected item at a time)
And as a side question: is there a convenient way to only update the data when it has actually changed?
Thankful for any suggestions!