Search This Blog

Monday, March 28, 2011

Flex force DataGrid refresh from source; Flex refresh datagrid after update

The problem is that DataGrid is bound to the ArrayList and in most cases this ArrayList is stored locally, so just calling  invalidateList() on DataGrid is not enough. I had my DataGrid bound to a MySQL data table and that’s how I succeeded:


FlexGlobals.topLevelApplication.getRunningTestsResult.token = FlexGlobals.topLevelApplication.testService.getRunningTests();


getRunningTestsResult() is my function in bounded service in PHP that downloads running tests. I had to “update” the array (i.e. fill it with data once more). Then I used invalidateList() that moved data from the Array to DataGrid.

You can you a [Bindable] Array to make changes “in real time”. So this is a half-solution.


I used FlexGlobals.topLevelApplication just because I updated DataGrid from ItemRunderer. If you do this locally there is no need to use global vars.


If you like this post, please leave a comment :)