Nobody knows? :(  Should be straightforward to all the Flexmasters out there! :)


  ----- Original Message ----- 
  From: Lex 
  To: [email protected] 
  Sent: Tuesday, March 13, 2007 7:09 PM
  Subject: [flexcoders] Need help with validation in a DataGrid



  I'm having a hard time putting a CurrencyValidator inside of a DataGrid.  The 
breakpoints would indicate that the data binds properly, but I get an 
unfortunately XML mess with big scrollbars in the datagrid instead of what I'd 
expect.

  Here's the GenericDollarFormatItemRenderer.mxml that intuition built:


------------------------------------------------------------------------------

  <?xml version="1.0" encoding="utf-8"?>
  <mx:HBox
  xmlns:mx="http://www.adobe.com/2006/mxml";> 

  <mx:Script> 
  <![CDATA[
  import mx.controls.dataGridClasses.DataGridColumn; 

  public var dataField:String; 

  [
  Bindable] 
  private var dataString:String; 

  public function newInstance():* 
  {
  return new GenericDollarFormatItemRenderer(); 
  }

  override public function set data(value:Object):void { 

  if( value != null ){ 
  super.data = value; 

  if( !(value is DataGridColumn) && dataField != null && value[dataField] != 
null ){ 
  dataString = value[dataField];
  obj:Object;
  }
  }
  }
  ]]>
  </mx:Script> 

  <mx:CurrencyValidator id="pnV" source="{ti}" property="text" 
  trigger="
  {ti}" triggerEvent="change" required="true" /> 
  <mx:TextInput id="ti" text="{dataString}" 
updateComplete="dataString=ti.text;" change="dataString=ti.text;"/> 
  </mx:HBox>

------------------------------------------------------------------------------



  I'm adding it to my DataGrid as follows:



------------------------------------------------------------------------------
  [Bindable] private var cf1:ClassFactory = new ClassFactory( 
GenericDollarFormatItemRenderer );
  ...

  cf1.properties = { dataField: 'price' };

  ...

  <mx:DataGridColumn headerText="price" textAlign="right" editable="true" 
itemRenderer="{cf1}" />



------------------------------------------------------------------------------


  The data source for the data grid is e4x XML drawn from an HTTPService.

  Any experts out there can elucidate this one?


  Thanks
  Alex


   

Reply via email to