Sorry to hear your posts get unanswered. I can only suggest a 'try'...did you 
try using the datagrid's indextoitemrenderer method instead of creating a new 
item renderer...

I have seen something similar in the DataGrid to Excel component on 
Flexdownloads.com but there the exercise was limited to extracting data from 
datagrid using the label function of the datagrid or if no label function 
specified, just use the data displayed, without the formatting css.

Web Manager
FlexDownloads.com

--- In flexcoders@yahoogroups.com, "Mike" <msl...@...> wrote:
>
> 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