I need extract the rendered text from all cells of a DataGrid, whether or not 
they are all displayed.  The following code dies because renderer is null:


public var dp:ArrayCollection = new ArrayCollection();

/** Obtain formatted text data from the DataGrid's dataProvider.  
* Other data generated by item renderers such as images are ignored. */
protected function extractData(originalComponent:*):void {
    var dg:DataGrid = DataGrid(originalComponent);
    for (var col:int=0; col<dg.columnCount; col++) {
        var rowArray:Array = [];
        for (var row:int=0; row<dg.rowCount; row++) {
            var index:int = dg.indicesToIndex(row, col);
            var renderer:IListItemRenderer = dg.createItemRenderer(index);
            var value:* = renderer.data;
            rowArray.push(value);
        }
        dp.addItem(rowArray);
    }
}

Most of my posts to this group go unanswered.  Hopefully this one won't suffer 
the same fate! :)

Mike


Reply via email to