views:

584

answers:

1

Hi, I have a DataGrid whose dataProvider is an Array of int Arrays (each with different lengths). Since each row has variable size (and I want to display all the data), I decided to extend DataGridColumn and overwrite the itemToLabel function to be able to display the data. The problem is that I also need to display the data differently depending on the int value.

I believe the only solution is to write an itemRenderer, but the only input the itemRenderer.set(data) function receives is the entire int Array. I believe I need either the exact string returned by itemToLabel or the column index of the cell the itemRenderer is for (to basically do the same parsing I implemented in itemToLabel).

I am using Flex 3.4. Thanks for your help.

A: 

http://flexgeek.wordpress.com/2007/05/30/tutorial-using-same-itemrenderer-for-multiple-columns/

From the article

"...we have to implement the interface IDropInListItemRenderer, which has two methods.

public function get listData():BaseListData
{
  return _listData;
}
public function set listData(value:BaseListData):void
{
  _listData = DataGridListData(value);
  invalidateProperties();
}

The _listData object holds the property columnIndex, which tells you which column does the itemRenderer belong to."

deux11