1 Reply Latest reply on Jan 15, 2011 8:07 PM by Gregory Lafrance

    Flex 4 Inline Item Editor Wiping Out Data

    Gregory Lafrance Level 6

      In this app that has an inline item editor, if you click on a location cell then press tab, the value in the location cell is wiped out.


      focusOut doesn't work, nor could I get this to work in DataGrid itemEditEnding etc.


      <?xml version="1.0"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
            import mx.collections.ArrayCollection;
            [Bindable] private var employees:ArrayCollection = new ArrayCollection([
              {fname: "Tom", lname: "Carson", location: "Los Angeles"},
              {fname: "Bob", lname: "Sandis", location: "Miami"},
              {fname: "Mary", lname: "Walart", location: "Los Angeles"},
              {fname: "Sam", lname: "Paulson", location: "New York"},
              {fname: "Frank", lname: "Trella", location: "Boston"},
              {fname: "Cindy", lname: "Garbeau", location: "Miami"}        
        <mx:DataGrid id="employeeDG" dataProvider="{employees}"
            <mx:DataGridColumn headerText="First Name" dataField="fname" width="100"/>
            <mx:DataGridColumn headerText="Last Name" dataField="lname" width="100"/>
            <mx:DataGridColumn headerText="Location" dataField="location" width="120"
                  <s:MXDataGridItemRenderer focusEnabled="true" height="22">
                        import mx.collections.ArrayList;
                        import mx.controls.Alert;
                          public function get location():String {
                            return locationList.selectedItem;
                    <s:DropDownList id="locationList" top="5" left="5"
                                    initialize="locationList.dataProvider =
                                    new ArrayList(['Boston', 'Los Angeles', 'Miami', 'New York'])"/>
        • 1. Re: Flex 4 Inline Item Editor Wiping Out Data
          Gregory Lafrance Level 6

          The definition for the inline item editor needs this:




          instead of this:




          This is because the itemEditEnd event sets the newData property (deep within the code) to the value of selectedItem, so if you have only selected the cell and have not yet selected a value in the DropDownList, such as selecting the cell then immediately tabbing out, the value gets wiped out.