Flex: Get an item from a AdvancedDataGrid given an index
- by David Wolever
I've got a subclass of AdvancedDataGrid showing a tree-like data structure. How can I, given the index returned by calculateDropIndex, get the item at that index?
After reading through reams of code, it seems like the least terrible way is:
var oldSelectedIndex:int = this.selectedIndex;
var mouseOverIndex:int = this.calculateDropIndex(event);
this.selectedItem = mouseOverIndex;
var item:* = this.selectedItem;
this.selectedIndex = oldSelectedIndex;
The other option seems to be tinkering around with the iterator property... But, judging by the way I've seen it used, that will get pretty harry pretty quickly too.
So, how can I get the item at a particular index in an advanced datagrid without going insane?