Iā€™m still not sure what your goal is and what things are under your control.  I 
can have a renderer that displays content not found in the data provider, or 
one that shows colors and no text.  A renderer can have multiple text widgets 
inside it and be mixed with other controls.  Is there some constraint on what 
kinds of renderers you want to grab text from?

Usually, you own the renderers.  Are folks supplying renderers for you to use?

In the simplest case, you are using default or simple renderers that leverage 
the default text computation performed by the DataGrid.  If that is true, while 
you could stuff each dataprovider item into a single renderer, that would be 
inefficient as the renderer will do lots of non-display work.  It would be 
better to simply call the default text computaton methods and gather the text.  
Code for that might look like:

Var s:String = ā€œā€;
Var n:int = dg.dataProvider.length;
Var m:int = dg.columns.length;
For (var i:int = 0 ; I < n; i++)
{
    var item:Object = dg.dataProvider.getItemAt(i)
    for (var j:int = 0; j < m; j++)
    {
        var dgc:DataGridColumn = dg.columns[j];
       s += dgc.itemToLabel(item);
    }
}

This code would take into account labelFunction if there are any and the 
dataField, but not any other ways of deriving text content.

On 2/12/10 6:41 PM, "Mike" <msl...@mslinn.com> wrote:






I must take the DataGrid as I find it.  If no labelFunction is defined, that 
approach won't work; also each item in the dataProvider might be manifested in 
0 or more columns.  This approach probably won't be general enough.

Thanks,

Mike

> You should be able to do this by running the labelFunction on all items in 
> the dataProvider.  You'll need to change the method signature to allow for a 
> null dataGridColumn, or pass in a dummy dataGridColumn.
>
> HTH;
>
> Amy
>






--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Reply via email to