3 Replies Latest reply on Mar 26, 2008 9:27 AM by joan_lafferty

    DataGrid itemEditEnd Not Firing

    lollerskatebuttes
      I have an editable datagrid that is visible when an "Edit" button is clicked. User clicks 'Edit', the grid to display, user clicks a row in column 1, edits the value, TABs to column 2, edits value and then moves the mouse to the 'OK' button and hides the grid, the itemEditEnd event does not fire and the dataProvider of the grid is not updated. If the user hits TAB while in column 2, or clicks in a different row the dataProvider is updated and itemEditEnd is fired as expected.

      So, how does one get itemEditEnd to fire when the data grid loses focus and a value has changed? Or do I forcibly have to focus a different row for it to actually fire the event? I could make each cell fire the itemEditEnd event on blur, but that seems like a horrible hack for something that should work....


        • 1. Re: DataGrid itemEditEnd Not Firing
          lollerskatebuttes Level 1
          So there is no way to get the event to fire w/o focusing a different cell of the grid? Really?
          • 2. Re: DataGrid itemEditEnd Not Firing
            goldman-x
            quote:

            Originally posted by: lollerskatebuttes
            I have an editable datagrid that is visible when an "Edit" button is clicked. User clicks 'Edit', the grid to display, user clicks a row in column 1, edits the value, TABs to column 2, edits value and then moves the mouse to the 'OK' button and hides the grid, the itemEditEnd event does not fire and the dataProvider of the grid is not updated. If the user hits TAB while in column 2, or clicks in a different row the dataProvider is updated and itemEditEnd is fired as expected.

            So, how does one get itemEditEnd to fire when the data grid loses focus and a value has changed? Or do I forcibly have to focus a different row for it to actually fire the event? I could make each cell fire the itemEditEnd event on blur, but that seems like a horrible hack for something that should work....





            I was running into similar problems in Flex 2 (maybe Flex 3 has improved the Datagrid?). Overall seemed like DataGrid code is riddled with bugs, itemEditBeginning was not firing when expected and itemEditEnd fired at weird times.

            I ended up doing my own custom renderer in datagrid cells and firing my own events from there. WAY more reliable.
            • 3. Re: DataGrid itemEditEnd Not Firing
              joan_lafferty Adobe Employee
              Can you post a simple sample or give more details about your DataGrid code. I ran this simple example and I always get the DataGrid's itemEditEnd event to fire when I press the Button to hide the DataGrid:

              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" width="800" height="700">
              <mx:Script>
              <![CDATA[

              [Bindable]
              private var dp:Array = [
              {color: "Blue", product: "Ice Cream"},
              {color: "Fuscia", product: "Care Bears"},
              {color: "Pink", product: "Balloons"}
              ];
              ]]>
              </mx:Script>

              <mx:HBox>
              <mx:Button label="toggle editable grid" click="myGrid.visible = !myGrid.visible" />
              <mx:DataGrid editable="true" id="myGrid" dataProvider="{dp}" visible="false"
              itemEditEnd="text1.text += 'itemEditEnd fired.'" showEffect="WipeDown"/>
              <mx:TextArea id="text1" />
              </mx:HBox>

              </mx:Application>

              Joan