This seems very similar to 
http://tech.groups.yahoo.com/group/flexcoders/message/116052
http://www.flex888.com/712/datagrid-with-flexible-row-height.html

and calling dataGrid.invalidateList(); from within itemEditor works fine. There 
seems to be a bug in DataGrid whereby, if editing in itemEditor causes 
itemEditor scrollBars to disappear, itemEditor position changes to one line 
above and both rows start getting edited. Here is the code sample to reproduce 
it. 

Steps:
1. Click on row 2, last column
2. Select all the text, and hit delete
3. Notice that cursor in on row 1
4. Start typing, notice both rows are getting the data
5. Click outside, editor closes, both rows have same data. 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="vertical" 
creationComplete="creationComplete()">
        <mx:Script>
                <![CDATA[
                        import mx.collections.ArrayCollection;
                        
                        private function creationComplete():void{
                                var arr:Array = []
                                arr.push(getObj("1", "nameOne", "Some Desc"));
                                arr.push(getObj("2", "name2", "Some Desc\n 
asdf\n test \n test\n test\n test\n test\n test"));
                                arr.push(getObj("3", "name3", "Some Desc"));
                                arr.push(getObj("4", "name4", "Some Desc"));
                                arr.push(getObj("5", "name5", "Some Desc"));
                                arr.push(getObj("6", "name6", "Some Desc"));
                                rolesDG.dataProvider = new ArrayCollection(arr);
                        }
                        
                        private function getObj(_id:String, _name:String, 
_desc:String):Object{
                                return { id: _id, name:_name, description:_desc 
};
                        }
                        
                ]]>
        </mx:Script>
        <mx:DataGrid id="rolesDG" width="100%" editable="true" 
variableRowHeight="true">
                        <mx:columns>
                                <mx:DataGridColumn headerText="#"       
dataField="id"  textAlign="center" width="20" editable="false"/>
                                <mx:DataGridColumn headerText="Role" 
dataField="name" width="150" textAlign="center" />
                                <mx:DataGridColumn headerText="Description" 
dataField="description" dataTipField="description"
                                         width="300" editorUsesEnterKey="true">
                                        <mx:itemEditor>
                                                <mx:Component>
                                                        <mx:TextArea 
xmlns:mx="http://www.adobe.com/2006/mxml"; keyUp="keyPressed(event)">
                                                                <mx:Script>
                                                                        
<![CDATA[
                                                                                
import mx.controls.DataGrid;
                                                                                
import mx.controls.dataGridClasses.DataGridListData;
                                                                                
private function keyPressed(event:Event):void{
                                                                                
        data[DataGridListData(this.listData).dataField] = this.text;
                                                                                
        
                                                                                
        DataGrid(this.owner).invalidateList();
                                                                                
}
                                                                        ]]>
                                                                </mx:Script>
                                                        </mx:TextArea>
                                                </mx:Component>
                                        </mx:itemEditor>
                                </mx:DataGridColumn>
                        </mx:columns>
                </mx:DataGrid>
</mx:Application>


Reply via email to