Skip to main content
November 25, 2013
Answered

Printing Datagrid

  • November 25, 2013
  • 1 reply
  • 1111 views

Hi,

I am a newbie to Flash.  I have a Datagrid (fl.controls.datagrid) that is populated and is visible on the screen and this part is working fine.  I would like to add printing of the datagrid.  How would I go about doing this.  I have tried this based on the code found here (http://www.knowledgesutra.com/forums/topic/29459-print-flash-datagrids-without-resizing/).  It prints the first page correctly, but the second page has first page data though correct number of records are printed.  I am using AS3 with Flash 5.

Thanks in advance for your help.

This topic has been closed for replies.
Correct answer kglad

Changed rowsPerPage.  Its value is calculated as 75 and printing only prints the first page.  My test grid contains 50 rows and 37 data rows fit in a single page.  Other than the rowsPerPage, I haven't changed any other code.  Do you want me to post my whole method here?


use:

function printPageF():void{

    if(pj.start()){

        for(var i:int=0;i<dataGrid.maxVerticalScrollPosition+rowsPerPage;i+=rowsPerPage){

        dataGrid.verticalScrollPosition = i;

        dataGrid.validateNow();

        pj.addPage(dataGrid);

        }

        pj.send();

    }

}

1 reply

kglad
Community Expert
Community Expert
November 25, 2013

do you need to scroll your datagrid to display some of the data you want to print?

November 25, 2013

Yes because the Datagrid contains more than one page of records.  I have tried setting the verticalScrollPosition but it does not work.

kglad
Community Expert
Community Expert
November 25, 2013

copy and paste the code you used to add pages to your print job.