Packagespark.components.gridClasses
Classpublic class DataGridEditor
InheritanceDataGridEditor Inheritance Object

Language Version : ActionScript 3.0
Product Version : Flex 4.5
Runtime Versions : Flash Player 10, AIR 2.5

The DataGridEditor contains all the logic and event handling needed to manage the life cycle of an item editor. A DataGridEditor is owned by a specified DataGrid. The owning DataGrid is responsible for calling initialize() to enable editing and uninitialize() when editing is no longer needed.



Public Properties
 PropertyDefined By
  dataGrid : DataGrid
[read-only] Reference to the DataGrid that created the editor.
DataGridEditor
  editedItemPosition : Object
The column and row index of the item renderer for the data provider item being edited, if any.
DataGridEditor
  editedItemRenderer : IVisualElement
[read-only] A reference to the item renderer in the DataGrid control whose item is currently being edited.
DataGridEditor
  editorColumnIndex : int
[read-only] The zero-based column index of the cell that is being edited.
DataGridEditor
  editorRowIndex : int
[read-only] The zero-based row index of the cell that is being edited.
DataGridEditor
  grid : Grid
[read-only] Convenience property to get the Grid associated with the parent DataGrid.
DataGridEditor
  itemEditorInstance : IGridItemEditor
A reference to the currently active instance of the item editor, if it exists.
DataGridEditor
Public Methods
 MethodDefined By
  
Constructor
DataGridEditor
  
endItemEditorSession(cancel:Boolean = false):Boolean
Closes the currently active editor and optionally saves the editor's value by calling the item editor's save() method.
DataGridEditor
  
initialize():void
Called by the DataGrid after construction to initialize the editor.
DataGridEditor
  
startItemEditorSession(rowIndex:int, columnIndex:int):Boolean
Start editing a cell for a specified row and column index.
DataGridEditor
  
The method is called to disable item editing on the DataGrid.
DataGridEditor
Protected Methods
 MethodDefined By
  
grid_gridMouseWheelHandler(event:MouseEvent):void
Grid MouseWheel event handler.
DataGridEditor
Property Detail
dataGridproperty
dataGrid:DataGrid  [read-only]

Language Version : ActionScript 3.0
Product Version : Flex 4.5
Runtime Versions : Flash Player 10, AIR 2.5

Reference to the DataGrid that created the editor.


Implementation
    public function get dataGrid():DataGrid
editedItemPositionproperty 
editedItemPosition:Object

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

The column and row index of the item renderer for the data provider item being edited, if any.

This Object has two fields, columnIndex and rowIndex, the zero-based column and row indexes of the item. For example: {columnIndex:2, rowIndex:3}

Setting this property scrolls the item into view and dispatches the itemEditBegin event to open an item editor on the specified item renderer.

The default value is null.


Implementation
    public function get editedItemPosition():Object
    public function set editedItemPosition(value:Object):void
editedItemRendererproperty 
editedItemRenderer:IVisualElement  [read-only]

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

A reference to the item renderer in the DataGrid control whose item is currently being edited.

From within an event listener for the itemEditBegin and itemEditEnd events, you can access the current value of the item being edited using the editedItemRenderer.data property.


Implementation
    public function get editedItemRenderer():IVisualElement
editorColumnIndexproperty 
editorColumnIndex:int  [read-only]

Language Version : ActionScript 3.0
Product Version : Flex 4.5
Runtime Versions : Flash Player 9, AIR 1.1

The zero-based column index of the cell that is being edited. The value is -1 if no cell is being edited.

The default value is -1.


Implementation
    public function get editorColumnIndex():int
editorRowIndexproperty 
editorRowIndex:int  [read-only]

Language Version : ActionScript 3.0
Product Version : Flex 4.5
Runtime Versions : Flash Player 9, AIR 1.1

The zero-based row index of the cell that is being edited. The value is -1 if no cell is being edited.

The default value is -1.


Implementation
    public function get editorRowIndex():int
gridproperty 
grid:Grid  [read-only]

Language Version : ActionScript 3.0
Product Version : Flex 4.5
Runtime Versions : Flash Player 10, AIR 2.5

Convenience property to get the Grid associated with the parent DataGrid.


Implementation
    public function get grid():Grid
itemEditorInstanceproperty 
public var itemEditorInstance:IGridItemEditor

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

A reference to the currently active instance of the item editor, if it exists.

To access the item editor instance and the new item value when an item is being edited, you use the itemEditorInstance property. The itemEditorInstance property is not valid until after the event listener for the itemEditBegin event executes. Therefore, you typically only access the itemEditorInstance property from within the event listener for the itemEditEnd event.

The DataGridColumn.itemEditor property defines the class of the item editor and, therefore, the data type of the item editor instance.

You do not set this property in MXML.

Constructor Detail
DataGridEditor()Constructor
public function DataGridEditor(dataGrid:DataGrid)

Language Version : ActionScript 3.0
Product Version : Flex 4.5
Runtime Versions : Flash Player 10, AIR 2.5

Constructor

Parameters
dataGrid:DataGrid — The owner of this editor.
Method Detail
endItemEditorSession()method
public function endItemEditorSession(cancel:Boolean = false):Boolean

Language Version : ActionScript 3.0
Product Version : Flex 4.5
Runtime Versions : Flash Player 10, AIR 2.0

Closes the currently active editor and optionally saves the editor's value by calling the item editor's save() method. If the cancel parameter is true, then the editor's cancel() method is called instead.

Parameters

cancel:Boolean (default = false) — if true then the data in the editor is discarded, otherwise it's saved.

Returns
Boolean — true if the data in the editor was saved, false otherwise.

See also

spark.components.IGridItemEditor
grid_gridMouseWheelHandler()method 
protected function grid_gridMouseWheelHandler(event:MouseEvent):void

Language Version : ActionScript 3.0
Product Version : Flex 4.11
Runtime Versions : Flash Player 11.8, AIR 3.8

Grid MouseWheel event handler. Used to end the itemeditor when scrolling on the grid. Default action is to save the edited contents.

Parameters

event:MouseEvent

initialize()method 
public function initialize():void

Language Version : ActionScript 3.0
Product Version : Flex 4.5
Runtime Versions : Flash Player 10, AIR 2.5

Called by the DataGrid after construction to initialize the editor. No item editors can be created until after this method is called.

startItemEditorSession()method 
public function startItemEditorSession(rowIndex:int, columnIndex:int):Boolean

Language Version : ActionScript 3.0
Product Version : Flex 4.5
Runtime Versions : Flash Player 10, AIR 2.5

Start editing a cell for a specified row and column index. Dispatches a GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_STARTING event.

Parameters

rowIndex:int — The zero-based row index of the cell to edit.
 
columnIndex:int — The zero-based column index of the cell to edit.

Returns
Boolean
uninitialize()method 
public function uninitialize():void

Language Version : ActionScript 3.0
Product Version : Flex 4.5
Runtime Versions : Flash Player 10, AIR 2.5

The method is called to disable item editing on the DataGrid.