Ok i think you are missing it, let me explain again.
As you suggested in message 1059 i am cloning my columns and then
setting them to the PDG:
var clonedcolumns:Array = [];
//clone the columns
for (var i:int; i < columns.length; i++)
{
var dgc:DataGridColumn = new DataGridColumn();
dgc.dataField = columns[i].dataField;
dgc.headerText = columns[i].headerText;
dgc.width = columns[i].width;
dgc.resizable = columns[i].resizable;
clonedcolumns.push(dgc);
}
dataGridToPrint.columns = clonedcolumns;
This works perfectly, so far so good.
Now i have a column with a Date and i use a labelFunction to give it a
proper format so i added this to the previous loop:
dgc.labelFunction = columns[i].labelFunction;
If I do this, it works and the PDG shows the result of the
labelFunction. So far so good
Now, the text that the labelFunction displays exceeds the column's
width so data doesn't fit (appears cut vertically). To fix this i use:
dataGridToPrint.variableRowHeight = true;
dataGridToPrint.wordWrap = true;
The result is that the labelFunction does display the correct data and
since it doesn't fit horizontally (column's width) it wraps it and
uses a variableHeigth BUT data appears cut horizontally, as if the
DataGrid didn't make the right calculation for the row's height or
something, the point is that the data appears cut horizontally (row's
height).
I then remove this line from the loop and also the labelFunction from
the column:
dgc.labelFunction = columns[i].labelFunction;
The result (remember wordWrap and variableHeight are still true) is
the default date format which doesn't fit the column's width and then
it is wrapped and then showed in a variable height row and it appears
complete!!! not half cut.
So the thing is, if i use wordWrap and variableHeight it works
perfectly as long as i don't use labelFunctions, if I do it shows data
incomplete (cut horizontally).
Any ideas on this?
--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> I must be missing something. Why can't you use the same labelFunctions
> in PDG? Most people's labelFunctions should be reusable. Your code
> example does not copy the labelFunction or wordWrap properties.
> Normally it would work if you did.
>
>
>
> -Alex
>
>
>
> ________________________________
>
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of dmiramontesval
> Sent: Wednesday, February 28, 2007 6:29 PM
> To: [email protected]
> Subject: [flexcomponents] Re: Question about PrintDataGrid
>
>
>
> Yes i did.
>
> Before setting the labelFunctions i tried that and it worked
> perfectly. The point is when i copy the labelFunction
>
> --- In [email protected]
> <mailto:flexcomponents%40yahoogroups.com> , "Alex Harui" <aharui@>
> wrote:
> >
> > Did you set variableRowHeight=true on the PrintDataGrid?
> >
> >
> >
> > ________________________________
> >
> > From: [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > [mailto:[email protected]
> <mailto:flexcomponents%40yahoogroups.com> ] On Behalf Of dmiramontesval
> > Sent: Wednesday, February 28, 2007 4:45 PM
> > To: [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > Subject: [flexcomponents] Question about PrintDataGrid
> >
> >
> >
> > Hello i am printing a datagrid whose columns have a fixed size and
> > some of them have labelFunctions.
> >
> > When i create my PrintDataGrid i need to set its columns as well so i
> > am using a loop like this to set them (as suggested by Alex Harui in
> > message 1059):
> >
> > var clonedcolumns:Array = [];
> > //clone the columns
> > for (var i:int; i < columns.length; i++)
> > {
> > var dgc:DataGridColumn = new DataGridColumn();
> > dgc.dataField = columns[i].dataField;
> > dgc.headerText = columns[i].headerText;
> > dgc.width = columns[i].width;
> > dgc.resizable = columns[i].resizable;
> > clonedcolumns.push(dgc);
> > }
> >
> > dataGridToPrint.columns = clonedcolumns;
> >
> > The thing is what should i do if a column has a labelFunction? how can
> > i clone a column like that?
> >
> > I tried this:
> > dgc.labelFunction = columns[i].labelFunction;
> >
> > Also I am setting the wordWrap and variableRowHeight properties both
> > to true (because this columns displays a long value), but the result
> > is that the columns that have a labelFunction display its data cut
> > horizontally(incomplete), that means that the variableHeight and
> > wordWrap properties are not working properly.
> >
> > So how can i clone this columns and have its data displayed correctly?
> >
>