datagrid use data of auto selectedIndex - data race - Flex
I have a datagrid that loads contnet from a database.
Once the data has been loaded I have a function that has selectedIndex=0;
Right after that I call another function that tries to display the selected item across a couple of la开发者_运维技巧bels.
The problem is nothing loads in the labels unless I run the functions twice.
I'm guessing its some sort of data race problem where the item hasn't been selected by the time the function that displays the items in labels runs.
So whats the workaround how can I get the item to be selected before the next function runs.
Put your next function call in a callLater();
selectedIndex = 0;
callLater(function():void {
//nextFunction()
});
精彩评论