Can you get the regular DataGrid to cut lines? Give it the same column sets and columns widths.
You might have to subclass the renderer and get it to be better about measuring. -Alex ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of dmiramontesval Sent: Thursday, March 01, 2007 4:14 PM To: [email protected] Subject: [flexcomponents] Re: Question about PrintDataGrid Ok i kept playing with this and there is something wrong: I made the date column to fit, and everything worked fine, now i added more columns which don't use a labelFunction but don't fit in their columns and the wordWrap is doing the same, cutting them horizontally (row's height is messed up). So i think there's an issue here, and the thing is that i can't make all the columns fit because of the paper width, so any more ideas? By the way i tried to do a printDataGrid.validateNow() and it also works funny, it prints some empty rows, for example if my grid was supposed to print 5 rows, when i use printDataGrid.validateNow() it prints those five plus 6 more empty rows. what should i do? --- In [email protected] <mailto:flexcomponents%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> wrote: > > If you change the width of the date column, does it show up correctly? > You might have hit a boundary condition between the measured size and > the actual size where the word-wrap wraps when actually displayed than > when it is measured. All it takes is one less or one more pixel and > something can go from two lines to three or more. > > > > -Alex > > > > ________________________________ > > From: [email protected] <mailto:flexcomponents%40yahoogroups.com> > [mailto:[email protected] <mailto:flexcomponents%40yahoogroups.com> ] On Behalf Of dmiramontesval > Sent: Thursday, March 01, 2007 3:05 PM > To: [email protected] <mailto:flexcomponents%40yahoogroups.com> > Subject: [flexcomponents] Re: Question about PrintDataGrid > > > > I am still stuck on this one, anyone help please > > --- In [email protected] <mailto:flexcomponents%40yahoogroups.com> > <mailto:flexcomponents%40yahoogroups.com> , "dmiramontesval" > <dmiramontesval@> wrote: > > > > 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] <mailto:flexcomponents%40yahoogroups.com> > <mailto:flexcomponents%40yahoogroups.com> , "Alex Harui" <aharui@> > 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:flexcomponents%40yahoogroups.com> > <mailto:flexcomponents%40yahoogroups.com> > > > [mailto:[email protected] <mailto:flexcomponents%40yahoogroups.com> > <mailto:flexcomponents%40yahoogroups.com> ] On Behalf Of dmiramontesval > > > Sent: Wednesday, February 28, 2007 6:29 PM > > > To: [email protected] <mailto:flexcomponents%40yahoogroups.com> > <mailto:flexcomponents%40yahoogroups.com> > > > 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> > <mailto:flexcomponents%40yahoogroups.com> > > > <mailto:flexcomponents%40yahoogroups.com> , "Alex Harui" <aharui@> > > > wrote: > > > > > > > > Did you set variableRowHeight=true on the PrintDataGrid? > > > > > > > > > > > > > > > > ________________________________ > > > > > > > > From: [email protected] <mailto:flexcomponents%40yahoogroups.com> > <mailto:flexcomponents%40yahoogroups.com> > > > <mailto:flexcomponents%40yahoogroups.com> > > > > [mailto:[email protected] <mailto:flexcomponents%40yahoogroups.com> > <mailto:flexcomponents%40yahoogroups.com> > > > <mailto:flexcomponents%40yahoogroups.com> ] On Behalf Of > dmiramontesval > > > > Sent: Wednesday, February 28, 2007 4:45 PM > > > > To: [email protected] <mailto:flexcomponents%40yahoogroups.com> > <mailto:flexcomponents%40yahoogroups.com> > > > <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? > > > > > > > > > >
