Flex: immediate edit in dataGrid cellEditor

When I edit a cell in dataGrid

, the changes are not applied to dataProvider

until I am done editing. Is there a way for the changes to show up dataProvider

in while editing?

I would imagine the way to do this would be to subclass the editor I am using in this case NumericStepper

, but I don't know how I would do it.

Is there some event that I need to trigger?

0


source to share


2 answers


If you need to reference anything outside of the itemeditor, as I did, it is through externalDocument.somePublicVar.

So, if you need to reference the dataprovider of the datafile being edited, you can update the var that is bound to the datagrid, but it should be public (I think), or you can directly edit the datagrids of the dataprovider.



In the element editor, you can simply catch the change event and update the value in the datap browser. But remember that the end edit item event will be fired and if you do any processing there that might mess up with your data provider too.

0


source


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.

0


source







All Articles