1 Reply Latest reply on Jul 13, 2010 6:04 AM by meirotstein

    Custom ItemRenderer makes the column non editable


      Hi Folks,


      I have a DataGrid which s editable, I've created a custom ItemRenderer to deal with special format needed for Date variables, for that I extended the mx:Text class in order to get access to the listData.dataField variable.


      The problem is that this makes the column non-editable, the other column in the table are editabe.


      When I used a VBox container the column was editable however I didn't get access to the listData, which I need for the dataField variable.


      Any help will be appreciated.





      Here is the my DateItemRenderer code:


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Text xmlns:fx="http://ns.adobe.com/mxml/2009" 
                <!-- Place non-visual elements (e.g., services, value objects) here -->
                     import aslib.common.Constants;
                     import aslib.common.Utils;
                     import aslib.connection.JSONConnector;
                     import mx.controls.dataGridClasses.DataGridListData;
                     import mx.controls.listClasses.ListData;
                     import mx.formatters.DateFormatter;
                     private var _dispValue:String;               
                     public function dateStr(val:Object):String {
                          var innerDt:Date;
                          if(!(val is Date))
                               innerDt = Utils.convertDateStr(val as String);
                               innerDt = val as Date;
                               var df:DateFormatter = new DateFormatter();
                               df.formatString = "DD/MM/YYYY";
                               var formatedDate:String = df.format(innerDt);                                                       
                               return formatedDate;
                               return "";
                     public override function set data(value:Object):void {
                          var date:Object = value[(listData as DataGridListData).dataField];
                               _dispValue = dateStr(date);