"ericbelair" <firstname.lastname@example.org> wrote in message
> Let's say I have a two column DataGrid. I want to get the itemRenderer for
> cell at the third row in the second column. Shouldn't this work?:
> var rendererIndex:int = dataGrid.indicesToIndex(2 1);
> var renderer:IListItemRenderer =
> It doesn't appear to be working, however. When I debug it, it returns the
> itemRenderer for the cell at the thrid row, but for the FIRST column. Why
> doesn't this do what you think it would?
You should practically never need to do this. What's the objective here?
I was trying to change the currentState to the default value (null) of all of the other itemRenderers in the column when the currentState in the itemRenderer changes to the non-default value. I found a better way to do this - using a Change Event listener on the listData.owner - but, it still doesn't seem like there should be a public function to access itemRenderers....
Hello, was looking for the solution to a similar problem and I came up with a solution:
public function indexToItemRendererAtColumn(index:int, columnIndex:int = 0):IListItemRenderer
var firstItemIndex:int = verticalScrollPosition - offscreenExtraRowsTop;
if (index < firstItemIndex ||
index >= firstItemIndex + listItems.length)
return listItems[index - firstItemIndex][columnIndex];
In my extended component of a DataGrid I added this method which uses most of the code from the indexToItemRenderer method of the ListBase class. The original Adobe code explicitly uses the column at index 0, this simply uses the specified columnIndex to return the item renderer you desire.