0

So we're doing well.

Got fields from an XMLListCollection to print in Flash Builder 4 AIR application using FlexPrintJob and a custom PrintView object with its own PrintDataGrid.

<mx:PrintDataGrid id="myDataGrid" width="100%">
    <mx:columns>
        <!-- "word" is the name of the XML field that prints-->
        <mx:DataGridColumn dataField="word" headerText="My Word List" />
    </mx:columns>
</mx:PrintDataGrid>

Now I want to be able to give the user an option to add a checkbox to the printout just before each word. Should I create another custom PrintView? how do I add the checkbox control (needed only for printouts, don't need them in the app itself) to a column?

1 Answers1

0

Figured out a solution on my own. Since these checkboxes needed only to be on the printed page, they did not need to be actual Checkbox controls, so I used the Unicode number for a blank white box (\u25a2 in actionscript syntax) in a labelFunction.

<mx:PrintDataGrid id="myDataGrid" width="100%">
    <mx:columns>
        <mx:DataGridColumn dataField="word" headerText="My Word List" labelFunction="addCheckBoxes" />
    </mx:columns>
</mx:PrintDataGrid>
<fx:Script>
    <![CDATA[
        function addCheckBoxes(theItem:Object, theColumn:DataGridColumn):String{
            var itemText:String = theItem[theColumn.dataField];
            var retString:String = "\u25a2 \u25a2 \u25a2  " + itemText;
            return retString;
        }
    ]]>
</fx:Script>

This code was placed in a copy of the PrintView I had originally created for the list.