I am trying to come up with the following solution.
My datagrid's data has a few fields that would filter an ArrayCollection to
a single element.
That single element has a Bitmap data to show an image in a column.
Here is some relevant code:
private var _ArrayCol:ArrayCollection = new ArrayCollection();
override public function set data(value:Object):void
{
super.data = value;
if (data)
{
_ArrayCol.source = someGlobalArray.source;
_ArrayCol.filterFunction = filterIcon;
_ArrayCol.refresh();
if (_ArrayCol.length == 1)
{
image = new Bitmap(_ArrayCol[0].Icon);
}
}
}
private function filterIcon(item:Object):Boolean
{
if (item.CategoryID == data.Category && item.ModeID == data.Mode &&
item.Importance == data.Importance)
{
return true;
}
else
return false;
}Currently I have data just for a few rows. So, initially I see icons in these rows, but once I start scrolling they disappear. I understand that my solution is not truly data driven. Question is what am I doing wrong? Thanks
