On my flex (flash builder 4) DataGrid - DataGridColumn , I have set a custom itemRenderer
itemRenderer="myComponents.EncounterDGItemRenderer".
My renderer is a Label
public class EncounterDGItemRenderer extends Label
I found that my tooltips (datatips) stopped working once I started using this custom renderer. I also found that I can set the tooltip on the label in the
override protected function updateDisplayList
by setting:
toolTip=data['addedDate'];
This works find, however the problem is I need to choose a different data field based on the column. I was hoping for something similar to how a DataGridColumn labelFunction works - where I have access to "column.headerText" or "column.dataField". However I only have access to the underlying data object, not the name of what is being displayed (unless I am missing something).
Is there a way in a data grid item renderer to know what the column header text is, or do you have a different approach?
So I came up with an answer that seems to work - I used a custom item renderer extending DataGridItemRenderer instead of extending 'Label'. Then, I set background = true and backgroundColor in there based on 'data' like I did above.
Then, the normal mxml show data tips / data tip field properties in the data grid columns work fine.
It makes sense though, this component should probably be upgraded to use Spark datagrid components - I am guessing that will allow background color and tool tips.