2 Replies Latest reply on Apr 30, 2012 12:29 AM by diana.c10

    DataGrid update cell event generated twice

    diana.c10

      Hi all,

       

      We are trying to create an editable cell in a datagrid, and in the itemEditEnd method to display an error message if the new value introduced is incorrect. The problem here is that the event is always generated twice.

       

      Do you know what could cause this?

       

      Thanks,

        • 1. Re: DataGrid update cell event generated twice
          ShardulSingh Level 3

          Hi,

           

          Can you add some additional info.As I checked at my end the things are working fine.

          You can check with the below sample applicaiton:-

           

          <?xml version="1.0" encoding="utf-8"?>

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                         xmlns:s="library://ns.adobe.com/flex/spark"

                         xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

              <fx:Declarations>

                  <!-- Place non-visual elements (e.g., services, value objects) here -->

              </fx:Declarations>

              <fx:Script>

                  <![CDATA[

                      import mx.collections.ArrayCollection;

                      import mx.controls.Alert;

                      import mx.events.DataGridEvent;

                     

                      [Bindable]

                      private var ac : ArrayCollection = new ArrayCollection([

                          {lbl :"lable1",data:"data1"},

                          {lbl :"lable2",data:"data2"},

                          {lbl :"lable3",data:"data3"}

                      ]);

           

                      protected function datagrid1_itemEditEndHandler(event:DataGridEvent):void

                      {

                          trace("Check");

                      }

           

                  ]]>

              </fx:Script>

              <mx:DataGrid dataProvider="{ac}" editable="true" itemEditEnd="datagrid1_itemEditEndHandler(event)">

                  <mx:columns>

                      <mx:DataGridColumn headerText="Lable" dataField="lbl" editable="true" />

                      <mx:DataGridColumn headerText="Data" dataField="data" editable="true" />

                  </mx:columns>

              </mx:DataGrid>

          </s:Application>

           

           

          with Regards,

          Shardul

          • 2. Re: DataGrid update cell event generated twice
            diana.c10 Level 1

            Yes, instead of the trace I have an Alert.show to notify the user that he is putting some wrong information there. I have till now a very ugly solution with a boolean just changing values to display or not display the alert.