HI all , i have a problem trying to do a double click edit datagrid
with custom item editor because , the handler of the double click
never enter en the function override
the custom class its this :
public class DoubleClickDataGrid extends DataGrid
{
/**
*Constructor with the double click actived by default
*/
public function DoubleClickDataGrid()
{
super();
doubleClickEnabled = true;
}
/**
*executed in doubleClick
*...@aoran the mouseEvent
*/
override protected function mouseDoubleClickHandler
(event:MouseEvent):void
{
var dataGridEvent:DataGridEvent;
var r:IListItemRenderer;
var dgColumn:DataGridColumn;
trace("in doubleClickHandler");
r = mouseEventToItemRenderer(event);
if (r && r != itemEditorInstance) // if exits a ItemRender and
its
not active the instance of the edit
{
var dilr:IDropInListItemRenderer =
IDropInListItemRenderer(r);
//the next is the same function of the mouseUpHandler
of the Grid
if (columns[dilr.listData.columnIndex].editable)
{
dgColumn = columns[dilr.listData.columnIndex];
dataGridEvent = new DataGridEvent
(DataGridEvent.ITEM_EDIT_BEGINNING, false, true);
// ITEM_EDIT events are cancelable
dataGridEvent.columnIndex = dilr.listData.columnIndex;
dataGridEvent.dataField = dgColumn.dataField;
trace("rowIndex "+dilr.listData.rowIndex + "Vertical
ScrollPostion "+verticalScrollPosition);
dataGridEvent.rowIndex = dilr.listData.rowIndex +
verticalScrollPosition;
dataGridEvent.itemRenderer = r;
dispatchEvent(dataGridEvent);
}
}
super.mouseDoubleClickHandler(event);
}
/**
* On MouseUp Event , pass in the firts click
* @param event The MouseEvent
*/
override protected function mouseUpHandler(event:MouseEvent):void
{
var r:IListItemRenderer;
var dgColumn:DataGridColumn;
//convert the position on the eventMouse to the itemrenderer
for the field of the grid
r = mouseEventToItemRenderer(event);
// verify is and itemRender SET to False before to call the
mouseUpHandler to not catch the event dispatched in the mouseUpHandler
of The grid
// The make the dispatch in the doubleclick and not in
mouseUpHandler
if (r)
{
//pass to the interface IDropInListItemRenderer To
access more
properties
var dilr:IDropInListItemRenderer =
IDropInListItemRenderer(r);
if (columns[dilr.listData.columnIndex].editable)
{
trace("editable true");
dgColumn = columns[dilr.listData.columnIndex];
dgColumn.editable = false; // put temporary
false
trace("editable false");
}
}
//Call of the mouseUpHandler of the grid
super.mouseUpHandler(event);
if (dgColumn){
dgColumn.editable = true; //sets the colum editable
again to use in
double click
trace("editable true");
}
}
}
i will appreciate any help or idea thanks very much
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---