1 Reply Latest reply on Feb 19, 2011 5:17 PM by Gregory Lafrance

    DataGrid does not update dataprovider on ItemEditEnd.

    Gregory Lafrance Level 6

      In the following code, click a cell, change the text, then press tab and edit the next cell.

       

      Only after moving to the third cell with another tab press does the first cell update.

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        creationComplete="init();" layout="horizontal">
        <mx:Script>
          <![CDATA[
            import mx.events.DataGridEvent;
            import mx.collections.ArrayCollection;
            import mx.utils.ObjectUtil;
            [Bindable] public var tabsAC:ArrayCollection = 
              new ArrayCollection([
                {label: "one"}, {label: "two"}, {label: "three"} 
              ]);
            
            private function init():void{
              ta.text = ObjectUtil.toString(tabsAC);
            }
            public function updateTabsHandler():void{
              ta.text = ObjectUtil.toString(tabsAC);
            }
          ]]>
        </mx:Script>
        <mx:DataGrid id="dG1" dataProvider="{tabsAC}" width="300" 
          editable="true" itemEditEnd="updateTabsHandler()"> 
          <mx:columns>
            <mx:DataGridColumn dataField="label" headerText="Name" 
              editable="true"/>
          </mx:columns>
        </mx:DataGrid>
        <mx:TextArea id="ta" width="100%" height="100%"/>
      </mx:Application>