Do you have custom header or item renderers?
No custom headers in this case.
I first had the issue with a grid that contains some of my
mx:DataGridColumnXxxxx components that have item renderers. So I suspected
those to be the problem.
I tried then next on a grid with just 3 of the standard
mx:DataGridColumns. And again the same issue: the grid data prints fine,
but no header text. Just the background gradient.
no, no embedded fonts!
I think you'll have to debug into it. I would set a breakpoint on
DataGridHeader mouseOverHandler and see what the header renderer properties
Are there any specific header renderer properties that could be important
for this issue?
Well, the text property as well as width, height, visible and alpha
I was not successful debugging this thing. But I was able to put together
a 'working' sample project. Any chance that I could send it to you to
I noticed a funny thing: with the sample project set up: when there is
just one grid on the main page, then it works. But as soon as there is a
second one, both don't work... Very strange!
Maybe you are reusing the column set from one Grid to the other.
I'm not sure I understand what you mean...
I made a component based on a s:Group. It contains just an mx:DataGrid
with its own array collection and a s;Button to launch the print.
In the main application file I reference the component twice. As a result
no datagrid headers when clicking the print button on either one.
But when I comment one grid out from the main application file, then the
print works as expected.
1 person found this helpful
If you did something like this:
Var cols:Array = new Array;
Dg.columns = cols;
PrintDG.columns = cols;
Then the same set of columns is being used in both grids which could cause
kind of. My source grid is a plain vanilla mxml definition.
But when it comes to printing I create a new instance of my printview
which contains a PrintDataGrid and then do (besides other things):
printView.printDataGrid.columns = sourceDataGrid.columns;
in order to get the same column properties in the print datagrid as in the
Is that what you mean with "using the same set of colums which could cause
If so, how to overcome this?
Yeah, that would cause the problem.
I would make a copy of the DataGridColumns.
Var cols:Array = sourceDataGrid.columns;
Var n:int = cols.length;
Var printcols:Array = new Array();
For (var i:int = 0; I < n; i++)
var newCol:DataGridColumn = new DataGridColumn;
newCol.dataField = cols[i].dataField;
newCol.headerText = cols[i].headerText;
newCol.width = cols[i].width;
PrintView.printDataGird.columns = printcols;
yes, that was the problem. Thanks a lot for your assistance!
One last question though:
as the quality of the printing is not that good when printed as a bitmap I
had to set printJob.printAsBitmap = false
But now the column headers (which by default have a gradient background)
print out very ugly. In Flex 3.x there was the headerColors style. But
this doesn't work in Flex 4.
So what is the easiest way to have a light grey background on my column
headers in the PrintDataGrid?
here a screenshot of the current print out (with these 'gradient'
1 person found this helpful
I would use a custom header renderer that looks better when printed.
ok - thank you again for your support!