dacat / sfapi

Automatically exported from code.google.com/p/sfapi
0 stars 0 forks source link

Double click on DataGrid item #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Thank you for this great library!

This is an enhancement request.

I'd like to get the ability to double click on a DataGrid item.
It can be implemented by the following code, which could just be added to
ClickCommands.as:

        /**
         * Dispatches a Click MouseEvent on the UIComponent of a Datagrid at a given
         * row and column index.  If the cell at the given row and column has
multiple 
         * UIComponents provid the componentIndexInCell in the function signature.
         * 
         * @param  datagridId  The ID of the Datagrid object
         * @param  rowIndex  The row index of the Component in the Datagrid
         * @param  colIndex  The colum index of the Component in the Datagrid
         * @param  componentIndexInCell The index of the column within the
rowIndex and columnIndex
         * @return      'true' if the button was clicked. An error message if the
call fails.
         */
        public function doFlexDoubleClickDataGridUIComponent(datagridId:String,
rowIndex:String, colIndex:String, componentIndexInCell:String = "0"):String
        {
            var child:Object = appTreeParser.getElement(datagridId);

            if(child == null)
            {
                return ErrorMessages.getError(ErrorMessages.ERROR_ELEMENT_NOT_FOUND,
[datagridId]);
            }

            // Assumes the DataGrid has only one ListBaseContentHolder
            var dgContentList:Object = Tools.getChildrenOfTypeFromContainer(child as
UIComponent, "mx.controls.listClasses::ListBaseContentHolder")[0];

            // Make certain the rowIndex and colIndex do not exceed the length of the 
            // Datagrid ListBaseContentHolders rows and columns.
            if (dgContentList.listItems.length > int(rowIndex) &&
dgContentList.listItems[int(rowIndex)].length > int(colIndex))
            {
                var cell:Object = dgContentList.listItems[int(rowIndex)][int(colIndex)];
                return String(cell.dispatchEvent(new MouseEvent(MouseEvent.DOUBLE_CLICK)));
            }

            return ErrorMessages.getError(ErrorMessages.ERROR_NO_CHILD_UICOMPONENT,
[datagridId,rowIndex,colIndex]);
        }

Thanks.

Original issue reported on code.google.com by antoine....@gmail.com on 4 May 2010 at 2:46

GoogleCodeExporter commented 9 years ago
Fixed.

Original comment by yugan...@gmail.com on 1 Jul 2010 at 9:52

GoogleCodeExporter commented 9 years ago

Original comment by yugan...@gmail.com on 1 Jul 2010 at 9:53