Kinda hard to tell from what you've sent.  If you see whole XML nodes it
implies that dataField is not set correctly.  It has to be
"@attributeName" for XML attributes.

 

What does the XML look like?

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Lex
Sent: Tuesday, March 13, 2007 6:27 PM
To: [email protected]
Subject: Re: [flexcoders] Need help with validation in a DataGrid

 

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

 

 

        ----- Original Message ----- 

        From: Lex <mailto:[EMAIL PROTECTED]>  

        To: [email protected]
<mailto:[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