This simple DataGrid doesn't appear to work right. 

Click one of the rows, and the value in the NumericStepper is zero, when I 
would expect it to pick up the value from the data provider.

Code (ignore all the script and outputs, just compile and run):

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="vertical">
<mx:Script>
<![CDATA[
        import mx.formatters.CurrencyFormatter;
        import mx.collections.ArrayCollection;
        
        [Bindable]
        public static var _moneyFormatter:CurrencyFormatter=new 
CurrencyFormatter();
        [Bindable]      
        private var ac:ArrayCollection=new ArrayCollection(
                [{value:1},{value:10},{value:100},{value:1000},{value:10000}]
        );

 public static function dataGridFormatNumber(item:Object, 
column:DataGridColumn):String{
        if (column.dataField == 'vat' && (item.vatable == 'e' || item.vatable 
== 'z') ){ 
                return _moneyFormatter.format(0);
        }
        return _moneyFormatter.format(item[column.dataField]);
 }
        public function debug(e:*):void{
                trace("value set to "+e.currentTarget.value);   
        }
 
]]>
</mx:Script>    
<mx:DataGrid id="detailGrid" width="952" height="170"
        dataProvider="{ac}"
        editable="true" allowMultipleSelection="true"
        >
        <mx:columns>            
        <mx:DataGridColumn dataField="value" headerText="Value"
                labelFunction="dataGridFormatNumber"
                editorDataField="value">
        <mx:itemEditor>
            <mx:Component>
                <mx:NumericStepper stepSize="0.01" minimum="0" 
maximum="99999999" 
                        dataChange="outerDocument.debug(event)"
                         >
            <mx:Script>
                <![CDATA[                       
                        override public function set data(d:Object):void{
                                trace('set data to '+d);
                                        super.data=d;
                                }
                        override public function set value(v:Number):void{
                                trace('set value to '+v);
                                        super.value=v;
                                }
                ]]>
                </mx:Script>
                </mx:NumericStepper>
            </mx:Component>
        </mx:itemEditor>
    </mx:DataGridColumn>
        </mx:columns>
</mx:DataGrid>    
 
</mx:Application>

-- 
Helping to collaboratively reintermediate 24/7 third-generation initiatives as 
part of the IT team of the year 2010, '09 and '08

****************************************************

This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at 
Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list 
of members is available for inspection at the registered office together with a 
list of those non members who are referred to as partners.  We use the word 
“partner” to refer to a member of the LLP, or an employee or consultant with 
equivalent standing and qualifications. Regulated by the Solicitors Regulation 
Authority.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 2500.

For more information about Halliwells LLP visit www.halliwells.com.

Reply via email to