R – Flex: Immediate editing in dataGrid cellEditor

apache-flexdatagridnumericstepper

When I am editing a cell in a dataGrid, the changes are not applied to the dataProvider until I finish editing. Is there a way that I can make the changes appear in the dataProvider whilst editing?

I would assume that the way of doing this would be to subclass the editor I am using, in this case NumericStepper, but I don't know how I would go about it.

Is there some sort of event that I need to trigger?

Best Answer

if you create your own itemEditor/itemRenderer you can do something like:

<mx:TextInput xmlns:mx="..." change="onChange(event)"
    implements="mx.controls.listClasses.IDropInListItemRenderer">
    <mx:Script>
        <![CDATA[

        import mx.controls.dataGridClasses.DataGridListData;
        import mx.controls.listClasses.BaseListData;
        [Bindable("dataChange")] private var _listData : BaseListData;
        public function get listData():BaseListData
        {
            return _listData;            
        }                   
        public function set listData( value : BaseListData ) : void
        {
            _listData = value;
        }

        private function onChange(event:Event):void
        {
             this.data[ (listData as DataGridListData).dataField ] = this.text;
        }
        ]]>
    </mx:Script>
</mx:TextInput>

hope this helps.

Related Topic