1 Reply Latest reply on Nov 10, 2011 9:53 AM by Flex harUI

    Spark datagrid - ending editing session

    Zolotoj Level 3

      When I start an editing session I am collecting item editors in the following way:

      //  code in datagrid class.

      public function startRowEditing(index:int):void{

                  if(index == editedRowIndex){

                      return;

                 

                  if(dataProvider && dataProvider.length >= index){

                      editedRowIndex = index;   

                      // Start moving thru data columns from right to left to end up with the first column going into editing

                      for(var i:int = columns.length - 2; i >= 0; i --){

                          var column:GridColumn = columns.getItemAt(i) as GridColumn;

                          if(column.editable && column.itemEditor){   

                              startItemEditorSession(index, i);

                              var editor:DataGridEditor = this.mx_internal::editor;

                              editors.addItem(editor);

                          }

                      }

                  }

              }

       

      then when the user wants to end editing I running this:

      public function endRowEditing(index:int, cancel:Boolean = false):void{

                  if(editedRowIndex != index){

                      return;

                  }

                  for each(var editor:DataGridEditor in editors){

                      editor.endItemEditorSession(cancel);

                  }

                  editors.removeAll();

       

              }

      while ever all it works I do have at least one strange effect. If I click on a cell to enter data then when I end session its item editor disappears,

      but if I tab into a cell, then after ending the session the item editor is still there.

      Any idea, please?

       

      Thanks