1 Reply Latest reply on Dec 8, 2008 10:20 AM by rtalton

    DataGrid absolute rowIndex

    marque_cam
      I'm fairly new to Flex, so I'm looking to see if anyone knows of an easier way to find the absolute (rather than relative) index of a row in a DataGrid from within a custom ItemRenderer.

      By default Flex provides the BaseListData.rowIndex method, however as it says in the documentation;

      quote:

      public var rowIndex:int
      The index of the row of the DataGrid, List, or Tree control relative to the currently visible rows of the control


      The way I managed to achieve what I was after is attached. That code is inside my custom ItemRenderer component and is called via the FlexEvent.DATA_CHANGE event. But finding the containing DataGrid's dataProvider and comparing the current element to that just seems a strange way of doing things - I'd have thought BaseListData would expose the absolute index of the current element as well as the index relative to what's being displayed.

      So, does anyone know an easier way of getting the absolute index?

      Cheers!