Maybe it’d just be easier to use a simple cell renderer of a VBox with a label inside and in your setValue method just adjust your properties as appropriate?  You’re right that labelFunction doesn’t really provide you a mechanism for getting the index that you’re working with.

 


From: [email protected] [mailto:[email protected]] On Behalf Of msloumac
Sent: Wednesday, May 11, 2005 8:44 AM
To: [email protected]
Subject: [flexcoders] Re: labelFunction item object and font style

 

Hi Matt (Both), Thanks for responding.

Matt C .. yes it is in the documentation under DataGridColumn syntax:

labelFunction

Function
Property
Specifies a function that determines the string to display in the
DataGrid control. The callback function takes a single argument
containing the data for the entire row, and returns a String. The
signature of the callback function is:

myLabelFunc(item:Object):String


Matt H .. I agree I could use setPropertiesAt if i had a handle on the
item objects index but I don't that is the problem.

alternatively i have tried to use setStyle which I can't use for the
same reason .. if i reference item.columnName.setStyle it does not
work as the item.columnName is translated to the actual string value
of the item object and not the "columnReference".

I am tearing my hair out over this one! if there was an formatter
equivilent <mx:StringFormatter class that took color and or
backgroundColor as arguments my life would be happier!

Can you think of anything else I could try?

Thanks in Advance ..


--- In [email protected], "Matt Horn" <[EMAIL PROTECTED]> wrote:
> You're right, Matt. It is in the MXML API Reference:

> http://livedocs.macromedia.com/flex/15/asdocs_en/mx/controls/listclasses
> /ScrollSelectList.html
>
>
> ________________________________
>
>       From: [email protected]
> [mailto:[email protected]] On Behalf Of Matt Chotin
>       Sent: Wednesday, May 11, 2005 1:09 AM
>       To: [email protected]
>       Subject: RE: [flexcoders] labelFunction item object and font
> style
>      
>      
>
>       I believe the 2nd argument to labelFunction when used in a
> DataGrid is the columnName.  This should be in the docs somewhere but I
> couldn't find it.
>
>      
>
>      
> ________________________________
>
>
>       From: [email protected]
> [mailto:[email protected]] On Behalf Of msloumac
>       Sent: Tuesday, May 10, 2005 3:52 AM
>       To: [email protected]
>       Subject: [flexcoders] labelFunction item object and font style
>
>      
>
>       I am using labelFunction in a DataGridColumn to return a string
> based
>       on the value of myColumn
>       I want to set the background property of myColumn but I dont
> know how
>       to get a refrence to the index position of the item object
> myColumn. I
>       have tried numerous variations on item.index without success,
> can
>       anyone help?
>      
>      
>       function getColumn(item:Object):String
>       {
>             if (item.myColumn=='this') {
>             myGrid.setPropertiesAt(item.index,
> {backgroundColor:0xB0BBD2});
>             return 'Total';
>             }
>             else if (item.myColumn=='that') {
>             return item.otherColumn;
>             }
>             else
>             {
>             return item.myColumn;
>             }
>       }
>      
>      
>      
>      
>
>
>      
> ________________________________
>
>       Yahoo! Groups Links
>      
>
>       *      To visit your group on the web, go to:
>             http://groups.yahoo.com/group/flexcoders/
>              
>       *      To unsubscribe from this group, send an email to:
>             [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>              
>       *      Your use of Yahoo! Groups is subject to the Yahoo! Terms
> of Service <http://docs.yahoo.com/info/terms/> .





Yahoo! Groups Links

Reply via email to