Flex 4 PrintDataGrid validNextPage doesn't work
I'm trying to create a report viewer for flex. The reports will be built from a PrintDataGrid since it's the only component in flex that supports multi-pages through validNextPage and nextPage().
Basically, I'm trying to populate a collection of the report pages through the following code:
var index:int = 0;
dataProvider = new ArrayCollection();
do {
var rep:Report = new Report();
rep.height = 841;
rep.width = 595;
rep.pageNumber = index + 1;
var i:int = index;
while (i > 0) {
rep.nextPage();
i--;
}
dataProvider.addItem(rep);
index++;
} while (rep.validNextPage);
My problem is that I get stuck in an endless loop since validNextPage returns true all the time. Am I trying to do something impossible? I saw some examples of adding a report page to FlexPrintJob but I've never seen an example of adding a report page to a component on the screen.
Another issue that I have is that this report should be dynamic (sortable) but I can't add the same report to 2 parents, hence I create a new Report on every iteration开发者_JAVA技巧 (but that will become problematic as I try to sort the report since i'll have several instances of this report)
Anyone has any idea how to do it?
could you provide more code. What is the Report object for example?
You can also check Adobe's website about Printing Multipage Output here.
精彩评论