RE: [flexcoders] Dynamically generated dataGrid not showing up in Print View component

2008-07-09 Thread Alex Harui
Try validateNow() at some point.  Printing runs before validation so
sometimes you have to force validation

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of bredwards358
Sent: Wednesday, July 09, 2008 11:31 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Dynamically generated dataGrid not showing up in
Print View component

 

I have a problem which is proving very difficult to place, I am
implementing logic to dynamically generate an advanced datagrid and
set it as the source to a printAdvancedDataGrid in a component which
is the print view of whatever report that needs to be printed. Problem
is, while it looks like the dataGrid, its columns and thier dataFields
are being generated properly, when I try to print out the report or
display the printView component in a simple little "print Preview" I
whipped up, the PrintAdvancedDataGrid is not showing up at all. I
really don't have much to go on so here's some code so you might be
able to see where I might be going wrong.

private function openPOPrint():void
{
dgProvider = new ArrayCollection();
DataManager.openIndex = 0;
dataManager.selectPOData();
dgProvider = model.purchaseOrderData;
reportHead = "Open Purchase Orders";
dfArray =
[{label:'POID'},{label:'DateUpdated'},{label:'ListCost'},{label:'Product
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 buildDG(dfArray:Array,headerArray:Array):void
{
var aColumnDef:Array = getColumnDefArray(dfArray,headerArray);
var bColumnDef:Object;
adgTemplate = new AdvancedDataGrid();
var adgc:AdvancedDataGridColumn;
var columnsToAdd:Array = adgTemplate.columns;
for(var i:int = 0;i http://www.cflex.net/showFileDetails.cfm?ObjectID=552&Object=File&Channe
lID=1
<http://www.cflex.net/showFileDetails.cfm?ObjectID=552&Object=File&Chann
elID=1> 
//Here is my doPrint();

private function doPrint():void {

var printJob:FlexPrintJob = new FlexPrintJob();
if (printJob.start()) {

var thePrintView:FormPrintView = new FormPrintView();
Application.application.addChild(thePrintView);

thePrintView.width=printJob.pageWidth;
thePrintView.height=printJob.pageHeight;
thePrintView.myDataGrid.source = adgTemplate;
thePrintView.prodTotal = prodTotal;
thePrintView.reportHead = reportHead;
thePrintView.myDataGrid.dataProvider = dgProvider;
thePrintView.showPage("single");

if(!thePrintView.myDataGrid.validNextPage)
{
printJob.addObject(thePrintView);
}
else
{
thePrintView.showPage("first");
printJob.addObject(thePrintView);
thePrintView.pageNumber++;

while(true)
{
thePrintView.myDataGrid.nextPage();
thePrintView.showPage("last"); 

if(!thePrintView.myDataGrid.validNextPage) 
{
printJob.addObject(thePrintView);
break;
}
else
{
thePrintView.showPage("middle");
printJob.addObject(thePrintView);
thePrintView.pageNumber++;
}
}
}
Application.application.removeChild(thePrintView);
}
printJob.send();
}

Thanks in advance, Brian Ross Edwards

 



[flexcoders] Dynamically generated dataGrid not showing up in Print View component

2008-07-09 Thread bredwards358
I have a problem which is proving very difficult to place, I am
implementing logic to dynamically generate an advanced datagrid and
set it as the source to a printAdvancedDataGrid in a component which
is the print view of whatever report that needs to be printed. Problem
is, while it looks like the dataGrid, its columns and thier dataFields
are being generated properly, when I try to print out the report or
display the printView component in a simple little "print Preview" I
whipped up, the PrintAdvancedDataGrid is not showing up at all. I
really don't have much to go on so here's some code so you might be
able to see where I might be going wrong.

private function openPOPrint():void
{
dgProvider = new ArrayCollection();
DataManager.openIndex = 0;
dataManager.selectPOData();
dgProvider = model.purchaseOrderData;
reportHead = "Open Purchase Orders";
dfArray =
[{label:'POID'},{label:'DateUpdated'},{label:'ListCost'},{label:'ProductCost'}]
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 buildDG(dfArray:Array,headerArray:Array):void
{
var aColumnDef:Array = getColumnDefArray(dfArray,headerArray);
var bColumnDef:Object;
adgTemplate = new AdvancedDataGrid();
var adgc:AdvancedDataGridColumn;
var columnsToAdd:Array = adgTemplate.columns;
for(var i:int = 0;i http://www.cflex.net/showFileDetails.cfm?ObjectID=552&Object=File&ChannelID=1
//Here is my doPrint();

private function doPrint():void {

var printJob:FlexPrintJob = new FlexPrintJob();
if (printJob.start()) {

var thePrintView:FormPrintView = new FormPrintView();
Application.application.addChild(thePrintView);

thePrintView.width=printJob.pageWidth;
thePrintView.height=printJob.pageHeight;
thePrintView.myDataGrid.source = adgTemplate;
thePrintView.prodTotal = prodTotal;
thePrintView.reportHead = reportHead;
thePrintView.myDataGrid.dataProvider = dgProvider;
thePrintView.showPage("single");

if(!thePrintView.myDataGrid.validNextPage)
{
printJob.addObject(thePrintView);
}
else
{
thePrintView.showPage("first");
printJob.addObject(thePrintView);
thePrintView.pageNumber++;

while(true)
{
thePrintView.myDataGrid.nextPage();
thePrintView.showPage("last");

if(!thePrintView.myDataGrid.validNextPage) 
{
printJob.addObject(thePrintView);
break;
}
else
{
thePrintView.showPage("middle");
printJob.addObject(thePrintView);
thePrintView.pageNumber++;
}
}
}
Application.application.removeChild(thePrintView);
}
printJob.send();
}

Thanks in advance, Brian Ross Edwards