Flex 1.0: Sample code for printing from a DataGrid
When a SWF is printed from the browser, the viewable area is printed. Any data that is outside of the viewable area will not be printed. The following TechNote provides a programmatic approach to printing all data within a Datagrid.
If you were to print the MXML document below from your web browser, any data in the scrollable (non-viewable) area would not be printed.
To print all of the data within the datagrid, you can create a custom actionscript function using the PrintJob() actionscipt class ( download the code sample). By using this approach you can print not only from datagrids but from other Flex components and custom components as well.
In the above example, when the Print button is clicked, the doPrint() function is called and a new PrintJob() object is created. Data is then added to the PrintJob and the print dialog will open in the browser.
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
