Ok, for flex 1.5 I had downloaded a nice AS file that would render
dates in cells for me. However dispite me updateing it to work in
Flex 2 it doesn't. Any ideas what I missed?
/*
* DateFormatCellRenderer is a simple Label-based cell renderer that
displays
* its item content in a known date format.
*/
package {
import mx.formatters.DateFormatter;
import mx.controls.Label;
class DateFormatCellRenderer extends Label
{
var getDataLabel:Function;
static var dateFmt:DateFormatter;
private function init() : Void
{
// instantiate the 1 and only date formatter (more
efficient than
// have a date formatter for every instance of the
cell renderer).
if( dateFmt == null ) {
dateFmt = new DateFormatter();
dateFmt.formatString = "MM/DD/YYYY";
}
super.initialize();
}
private function setValue(str:String, item:Object,
sel:Boolean):Void
{
if( item != null ) {
// format the date value in the cell
this.text = dateFmt.format(item[getDataLabel
()]);
}
else {
this.text = "";
}
}
private function size() : Void
{
this.setActualSize(explicitWidth,explicitHeight);
}
}
}
btw the size function change is a complete guess on my part.
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
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]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/