Here it is:
public function showPage(pageType:String):void
{
if(pageType == "single")
{
c_Header.includeInLayout=true;
c_Header.visible = true;
c_Footer.visible = true;
c_Footer.includeInLayout = true;
//FIXME!!! this fix is to make 16 procs to be printed without cutting
the last row
pdg_Procedures.height +=5;
pdg_Deposits.visible = true;
pdg_Deposits.includeInLayout = true;
}
if(pageType == "first")
{
c_Header.includeInLayout=true;
c_Header.visible = true;
c_Footer.visible = false;
c_Footer.includeInLayout = false;
//another fix as includeInLayout & visible don't
affect the PDG size
pdg_.height += c_Footer.height;
pdg_Deposits.visible = false;
pdg_Deposits.includeInLayout = false;
pdg_Procedures.height += pdg_Deposits.height;
}
if(pageType == "middle")
{
// The header won't be used again; hide it.
c_Header.includeInLayout=false;
c_Header.visible = false;
//no need - it works when PDG is an only
component on page
//pdg_Procedures.height += c_Header.height;
c_Footer.visible = false;
c_Footer.includeInLayout = false;
//no need - it works when PDG is an only
component on page
//pdg_Procedures.height += c_Footer.height;
pdg_Deposits.visible = false;
pdg_Deposits.includeInLayout = false;
//no need - it works when PDG is an only component
on page
//pdg_Procedures.height += pdg_Deposits.height;
}
if(pageType == "last")
{
c_Header.includeInLayout=false;
c_Header.visible = false;
//have to do it to adjust PDG height
pdg_Procedures.height += c_Header.height;
c_Footer.visible = true;
c_Footer.includeInLayout = true;
pdg_Deposits.visible = true;
pdg_Deposits.includeInLayout = true;
}
if(pageType == "last_deposits")
{
c_Header.includeInLayout=false;
c_Header.visible = false;
pdg_Procedures.visible = false;
pdg_Procedures.includeInLayout = false;
c_Footer.visible = false;
c_Footer.includeInLayout = false;
pdg_Deposits.visible = true;
pdg_Deposits.includeInLayout = true;
pdg_Deposits.height += c_Header.height;
pdg_Deposits.height += c_Footer.height;
pdg_Deposits.height += dg_Procedures.height;
}
//Update the DataGrid layout to reflect the results.
validateNow();
//don't ask me why - but in this particular case
//Flex places a grid with height = 0
//and it is still visible.
if (pdg_Procedures.height == 0)
{
pdg_Procedures.visible = false;
}
}
As you can see, I've got pretty complex layout:
Header
PDG
Footer
and second PDG
Here the doPrint() function:
if (l_printJob.start())
{
m_thePrintView.width = l_printJob.pageWidth;
m_thePrintView.height = l_printJob.pageHeight;
m_thePrintView.showPage("single");
if(!m_thePrintView.pdg_Procedures.validNextPage)
{
l_printJob.addObject(m_thePrintView);
}
else
{
m_thePrintView.showPage("first");
l_printJob.addObject(m_thePrintView);
m_thePrintView.m_iPageNumber++;
while(true)
{
m_thePrintView.pdg_Procedures.nextPage();
m_thePrintView.showPage("last");
if(!m_thePrintView.pdg_Procedures.validNextPage)
{
l_printJob.addObject(m_thePrintView);
m_thePrintView.m_iPageNumber++;
while (m_thePrintView.pdg_Deposits.validNextPage)
{
m_thePrintView.pdg_Deposits.nextPage();
m_thePrintView.showPage("last_deposits");
l_printJob.addObject(m_thePrintView);
m_thePrintView.m_iPageNumber++;
}
break;
}
else
{
m_thePrintView.showPage("middle");
l_printJob.addObject(m_thePrintView);
m_thePrintView.m_iPageNumber++;
}
}
}
}
l_printJob.send();
}
Cheers,
Dmitri.
--- In [email protected], "jf317820" <[EMAIL PROTECTED]> wrote:
>
> If you're referring to the showPage() function, I tried your
> suggestion and it's crashing the runtime...can you post more sample
code?
>
> --- In [email protected], "mitek17" <mitek17@> wrote:
> >
> > as a I mentioned before - I am adding 5 pixels to the PDG while doing
> > the layout. Works in my case so far.
> >
> > PS Strange, but includeInLayout=false & visible=false for the
> > component which is placed _after_ the PDG don't work for me. I am
> > changing the PDG height manually.
> >
> > Cheers,
> > Smitri.
> >
> >
> > --- In [email protected], "jf317820" <jf317820@> wrote:
> > >
> > > Anyone have any other workarounds for this issue other than the
> > > subclass suggested on the bugs site? I'll try anything at this
point.
> > >
> > > Thanks in advance.
> > > --- In [email protected], "mitek17" <mitek17@> wrote:
> > > >
> > > > Hi Alex!
> > > >
> > > > Thanks for the comments. At least we all know that it will be
fixed
> > > > eventually.
> > > >
> > > > Cheers,
> > > > Dmitri Girski.
> > > >
> > > >
> > > > --- In [email protected], "Alex Harui" <aharui@> wrote:
> > > > >
> > > > > I just updated some info in the bug. It is deferred because the
> > > Player
> > > > > has some issues that we can't easily workaround that prevent
> us from
> > > > > having guaranteed solution. I added code for a temporary
> workaround
> > > > > that will hopefully work in 'more' cases but not all.
> > > > >
> > > > >
> > > > >
> > > > > -Alex
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > >
> > > > > From: [email protected]
> > > [mailto:[EMAIL PROTECTED] On
> > > > > Behalf Of mitek17
> > > > > Sent: Monday, January 14, 2008 8:51 PM
> > > > > To: [email protected]
> > > > > Subject: [flexcoders] Re: PrintDataGrid variablerowheight issue
> > > > >
> > > > >
> > > > >
> > > > > Hooray! It is in the state of Deferred Closed. :(
> > > > >
> > > > > PS I am just using a workaround - in the function which does a
> > > > > printing layout (e.g. showPrint() in SDK help) I do the
following:
> > > > >
> > > > > pdg_procedures.height +=5;
> > > > >
> > > > > This extra 5 pixels fix the problem.
> > > > >
> > > > > Cheers,
> > > > > Dmitri.
> > > > >
> > > > > --- In [email protected]
> > > <mailto:flexcoders%40yahoogroups.com>
> > > > > , "jf317820" <jf317820@> wrote:
> > > > > >
> > > > > > https://bugs.adobe.com/jira/browse/SDK-14174
> > > > > <https://bugs.adobe.com/jira/browse/SDK-14174>
> > > > > >
> > > > >
> > > >
> > >
> >
>