0
votes

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?

1
Are you using Flex 4? Why not use the Spark DataGrid?J_A_X
I am using a custom component (ResuableFx) DataGrid library, it has filtering and custom search capabilities. It works great and I am using a custom item renderer so I can change the text / background color, but then I loose my tooltips.Scott Szretter

1 Answers

0
votes

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.