This content has been marked as final. Show 3 replies
You can use custom renderer's in each row/column intersection. Take a look at this example: http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom- item-renderer/
Don't really understand you. Could you be more verbose please?
Just to clarify, what I want is all the items in the first DataGridColumn to look/act like the column header along the top. Could you use an itemRenderer to do this? I had a look into the DataGridColumn source to see if I could find where the column header formatting is defined but couldn't find anything...
<disclaimer> I am a beginner :-)
Sorry, I really didn't have the time to get into it. This link is to an example with code that does exactly what you are looking for. You really don't need a custom item renderer to do what you want to do, but you may want to do so if you want to provide some functionality that is dependent on the data values.
The example shows rows of data within an XML object (which could be retrieved from an HTTP service) and each row has the first column value from the name attribute. I'm assuming that you could have 1 to ...n rows and that each row would require a label in the first column. It would be a matter of providing each row with the label you wanted to display as in the example.
The PriceLabel.as class is customized to render the values red or black dependent on a positive or negative number. It is then used as the value for the attribute itemRenderer ( itemRenderer="PriceLabel" ). FLEX finds this class and uses it as the cell object for that column. The inherited method updateDisplayList is invoked and each item ( or cell) within that column evaluates the value that is set and renders the number accordingly.