package { import flash.events.MouseEvent; import mx.controls.AdvancedDataGrid; import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn; import mx.controls.listClasses.IDropInListItemRenderer; import mx.controls.listClasses.IListItemRenderer; import mx.events.AdvancedDataGridEvent; public class DoubleClickAdvancedDataGrid extends AdvancedDataGrid { public function DoubleClickAdvancedDataGrid() { super(); this.doubleClickEnabled = true; } override protected function mouseDoubleClickHandler(event:MouseEvent):void { var advancedDataGridEvent:AdvancedDataGridEvent; var r:IListItemRenderer; var dgColumn:AdvancedDataGridColumn; r = mouseEventToItemRenderer(event); if (r && r != itemEditorInstance) { var dilr:IDropInListItemRenderer = IDropInListItemRenderer(r); if (columns[dilr.listData.columnIndex].editable) { dgColumn = columns[dilr.listData.columnIndex]; advancedDataGridEvent = new AdvancedDataGridEvent(AdvancedDataGridEvent.ITEM_EDIT_BEGINNING, false, true); // ITEM_EDIT events are cancelable advancedDataGridEvent.columnIndex = dilr.listData.columnIndex; advancedDataGridEvent.dataField = dgColumn.dataField; advancedDataGridEvent.rowIndex = dilr.listData.rowIndex + verticalScrollPosition; advancedDataGridEvent.itemRenderer = r; dispatchEvent(advancedDataGridEvent); } } super.mouseDoubleClickHandler(event); } override protected function mouseUpHandler(event:MouseEvent):void { var r:IListItemRenderer; var dgColumn:AdvancedDataGridColumn; r = mouseEventToItemRenderer(event); if (r) { var dilr:IDropInListItemRenderer = IDropInListItemRenderer(r); if (columns[dilr.listData.columnIndex].editable) { dgColumn = columns[dilr.listData.columnIndex]; dgColumn.editable = false; } } super.mouseUpHandler(event); if (dgColumn) dgColumn.editable = true; } } }