Flex: Get an item from a AdvancedDataGrid given an index

Posted by David Wolever on Stack Overflow See other posts from Stack Overflow or by David Wolever
Published on 2009-07-07T18:29:54Z Indexed on 2010/03/18 19:01 UTC
Read the original article Hit count: 435

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about flex3

Related posts about flex