Ho would I be able to specify other dataField based from your example?

Say in my datagrid, col1's datafield is COL1 and col2 is COL2.

Using the label function, I need to fully qualify the datafield name like:

df.format(item[col.COL1])

which in turn I could only use for COL1.

Since I have some datagrid where the same date formatting can be used, then 
perhaps re-using the same label function would be of good help.

Thanks.



________________________________
From: Alex Harui <[email protected]>
To: "[email protected]" <[email protected]>
Sent: Wed, 17 March, 2010 19:13:26
Subject: Re: [flexcoders] Re: Reuse a LabelFunction

  
Should be df.format(item[ col.dataField] )


On 3/17/10 1:41 PM, "valdhor" <valdhorlists@ embarqmail. com> wrote:



>> 
>> 
>>   
>
>>Use an itemRenderer instead.
>
>>If you need help creating one, let me know.
>
>>--- In flexcod...@yahoogro ups.com <mailto:flexcoders% 40yahoogroups. com> , 
>>Angelo Anolin <angelo_anolin@ ...> wrote:
>>>
>>> Hi FlexCoders,
>>> 
>>> I have created a labelfunction which I use in my datagrid to format the 
>>> display value.
>>> 
>>> <mx:DateFormatter id="df" formatString="DD/MM/YYYY" />
>>> 
>>> And this is the AS function
>>> private function labelFunctionTest( itm:Object, col:DataGridColumn) :String
>>> {
>>>     return df.format(itm. DataFieldNamefor Col1);
>>> }
>>> 
>>> Is there a way so that I could reuse the same label function to other 
>>> datagrid columns?  As you can see from the script above, I am only using 
>>> the function to Col1 for the datagrid.  How would I be able to specify the 
>>> datafield if I am going to reuse the same with other datagrid columns?
>>> 
>>> Thanks.
>>>
>
>> 
>>   
>
>
>
-- 
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs. adobe.com/ aharui
 
 


      

Reply via email to