I was having issues with my DataGrid scrolling to the top when my grid updated from the server. It is very aggravating as a user when you are milling about and *BAM* it scrolls away.
1 2 3 4 5 6
var storeItemForUpdate:ItemVO = grid.selectedItem;; var vScroll:int = grid.verticalScrollPosition; arrayCollection.source = updatedDataArray grid.validateNow(); grid.verticalScrollPosition = vScroll; grid.selectedItem = storeItemForUpdate;
The current selection is stored, the scroll position is stored, the grid is updated, validated, and then the stored variables are applied without so much as a flicker on the screen for the user. Much better.
The Flex – Preventing DataGrid scrolling when the dataprovider is updated. by Joel Hooks, unless otherwise expressly stated, is licensed under a Creative Commons Attribution 3.0 United States License.