Flex: How is data passed from DataGridColumn.itemToLabel to DataGrid.itemRenderer.set(data)?
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 proble开发者_如何转开发m 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.
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."
精彩评论