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