= numRows) { pj.addObject(myDataGrid); } // Otherwise, the job requires multiple pages. else { // Create the first page and add it to the print job. myDataGrid.percentHeight = 100; //Update the DataGrid layout to reflect the results of this function. updateLayout(); pj.addObject(myDataGrid); // Loop through the following code until all pages are queued. while(true) { // Move the next page of data to the top of the print grid. myDataGrid.nextPage(); // If the page holds the remaining data, or if the last page // was completely filled by the last grid data, queue it for // printing. if((myDataGrid.vPosition + myDataGrid.rowCount -1) >= numRows) { if(myDataGrid.vPosition >= numRows) // The previous page completed the grid, but the footer // didn't fit. Hide the data grid and print only the footer. { myDataGrid.height = 0; myDataGrid.visible = false; } updateLayout(); pj.addObject(myDataGrid); // The last page has been queued. Exit the print loop. break; } else // This is not the last page. Queue a middle page. { pj.addObject(myDataGrid); } } } // All pages are queued; remove the FormPrintView control to free memory. // removeChild(thePrintView); } // Send the job to the printer. pj.send(); } ]]>