Overview:
I have an advancedDataGrid that I am using a GroupingCollection on and I want to be able to change the individual DefaultLeafIcons (no children icon) based upon a value I get from the dataProvider. Can anyone shed some light on how this is done.
Details: In the data that I receive there is an isShared value that is either 1 or 0 if the value is 1 I want to be able to display abc.png if the value is 0 display xyz.png.
I am using Flex 3.6 SDK.
I believe you should implement an iconFunction for the datagrid.
a sample iconFunction implementation would look like the following.
[Embed("abc.png")]
private var abcIcon:Class;
[Embed("xyz.png")]
private var xyzIcon:Class;
private function iconFunc(item:Object):Class {
var iconClass:Class;
var itemType:int = item.isShared; //TypeCast item accordingly.
switch(itemType)
{ case 1: iconClass = abcIcon;
break;
case 0: iconClass = xyzIcon;
break;
}
return iconClass;
}
Remember to link the iconFunc with the datagrid by adding the following attribute.
iconFunction="iconFunc"