2 Replies Latest reply on Mar 20, 2007 10:00 PM by Säeven

    DataGrid and Validation?

      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">
      import mx.controls.dataGridClasses.DataGridColumn;

      public var dataField:String;

      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];

      <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;"/>


      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? If I'm on the completely wrong track, let me know! This is a needed to be done yesterday type of thing :)