Revision history [back]

click to hide/show revision 1
initial version

answered 2013-02-20 03:24:27 +0800

dennis gravatar image dennis

http://www.javaworld.com....

I looked into the interface JRDataSouce

public interface JRDataSource
{
    public boolean next() throws JRException;
    public Object getFieldValue(JRField jrField) throws JRException;
}

there is a cursor method next() to control the row of datasource, and form the code , you reused the same datasource. so it might be already moved to last row then you got empty result.

you could try to use a new datasource (or reset it ?) , or why not get report from component jasperreport directly (if the argument are all the same)?

I looked into the interface JRDataSouce

public interface JRDataSource
{
    public boolean next() throws JRException;
    public Object getFieldValue(JRField jrField) throws JRException;
}

there is a cursor method next() to control the row of datasource, and form the from your code , you reused the same datasource. so it might be already moved to last row then you got empty result.

you could try to use a new datasource (or reset it ?) , or why not get report from component jasperreport directly (if the argument are all the same)?

something like:

<vbox width="100%" align="right" id="buttonbar">
    <hbox width="160px" height="40px" align="right">
        <toolbarbutton  onClick="@command('downloadPDF',report=reportComp.report)" 
            id="pdfReport" image="/images
            /pdf_ico.jpg"/> 
    </hbox>
</vbox>
<jasperreport id="reportComp"  src="@load(vm.reportSource)" type="@load(vm.reportType)" 
parameters="@load(vm.parameters)" datasource="@load(vm.datasource)" width="100%" height="700px" />


@Command
public void downloadPDF(@BindParam("report") Media report){

   Filedownload.save(report, selectedStatement.getFullDate().getValue()+"."+report.getFormat());
}
Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More