--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Try validateNow() at some point.  Printing runs before validation so
> sometimes you have to force validation
> 
>  
> 
> ________________________________

Ok, update time, I discovered that my dynamic dataGrid generation was
working perfectly as I found it inside my main application window with
all the required data and columns, however, the PrintAdvancedDataGrid
inside the PrintView Component still is not showing up. I have not
tried actually printing it yet since the last time I tried it queued
up 366 pages!

Anyhoo, here's the printPreview function I wrote to display the
component inside a window so I can see what it looks like without
wasting too much paper. I think the issue might be with how things are
assigned to each other. Things look a bit confusing at the moment but
at least I can build the dataGrids correctly.

Here's my code thus far:

private function openPOPrint():void
                {
                        dgProvider = new ArrayCollection();
                        MatMgr.Globals.openIndex = 0;
                        dataManager.selectOpenPO();
                        dgProvider = model.purchaseOrderData;
                        reportHead = "Open Purchase Orders";
                        dfArray =
[{label:'POID'},{label:'DateUpdated'},{label:'ProductList'},{label:'Cost'}]
                        headerArray = [{label:'PO
ID'},{label:'Date'},{label:'List'},{label:'Cost'}]
                        Alert.show("Preview?","Preview?",Alert.YES
|Alert.NO|Alert.CANCEL,null,clickHandler);
                        //doPrint();
                }
                private function clickHandler(event:CloseEvent):void
                {
                        if(event.detail == Alert.YES)
                        {
                                buildDG(dfArray,headerArray);
                                printPreview();
                        }
                        else if(event.detail == Alert.NO)
                        {
                                buildDG(dfArray,headerArray);
                                doPrint();
                        }
                }
//Keep in mind the buildDG function works perfectly in building
//the data grids. I'm just having trouble getting the print data grid
//to show up in the print preview component
public function printPreview():void
        {
                var thePrintView:FormPrintView = new FormPrintView();
                preWindow = new Window();
                preWindow.title = "Print Preview";
                preWindow.width = 800;
                preWindow.height = 600;
                preWindow.addChild(thePrintView);
                thePrintView.width = preWindow.width;
                thePrintView.height = preWindow.height;
                adgTemplate.dataProvider = dgProvider;
                thePrintView.myDataGrid.source = adgTemplate;
                thePrintView.prodTotal = prodTotal;
                thePrintView.reportHead = reportHead;
                thePrintView.myDataGrid.dataProvider = dgProvider;
                thePrintView.myDataGrid.validateNow();
                thePrintView.showPage("single");
                preWindow.open();
        }

Thanks in advance,
Brian Ross Edwards
Tech-Connect LLC

Reply via email to