Absolute / Relative Flex Datagrid Component RowIndex
For performance reasons, Flex Datagrid component swap elements into rows while scolling. Flex don’t create as many rows as entries in the dataprovider. So to get the actual dataprovider related index, when using for example a listener to a mouse event on the datagrid component :
private function onItemRollOver(event:ListEvent):void
{
var rowIndex:int = event.rowIndex; // or myDG.listData.rowIndex
}
the rowIndex here is relative to visible rows in the datagrid. One way to get the right one “related to dataprovider” is to add the datagrid vertical scroll position
var rowIndex:int = myDG.listData.rowIndex + myDG.verticalScrollPosition;
If you have a better way to do it, please leave a comment …
À propos de cette entrée
You’re currently reading “Absolute / Relative Flex Datagrid Component RowIndex,” an entry on Developer
- Publié:
- février 22, 2009 / 11:34
- Catégorie:
- Flex/AIR
- Mots-clefs :
1 Commentaire
Aller au formulaire commentaire | comment rss [?] | trackback uri [?]