ui-grid: single click on "focused" cell does not cause it to enter edit mode

596 views
Skip to first unread message

Nick Carter

unread,
Oct 22, 2015, 3:56:33 PM10/22/15
to AngularJS
Does anyone know a way of configuring - or hacking through event-driven programmatic control of the grid - ui-grid so that a single click on a "focused" cell switches to editable input mode?

For clarity, "focus" here does not refer to an html input, but the cellNav functionality in ui-grid, which renders the currently "focused" cell contents with "ui-grid-cell-focus" class.

I've trolled/trawled documentation as well as ui-grid source in hopes of finding a fix (including programmatically "clearing" the "focus", thus hopefully allowing a single click to bring it back to edit mode) with no great confidence in a fix thus far.

Thanks!

(Stack Overflow is being a bastard right now and not letting me post despite not posting anything in forever...)

Amol Kolekar

unread,
Feb 8, 2019, 5:30:30 AM2/8/19
to Angular and AngularJS discussion
Did you got solution

Tito

unread,
Feb 8, 2019, 8:21:21 AM2/8/19
to Angular and AngularJS discussion
Ui-grid is so rich it can be dizzying
Been working on a form the last 2 weeks and I am happy to help
Are you looking for cell level focus or row level focus?

Tito

unread,
Feb 8, 2019, 10:19:06 AM2/8/19
to Angular and AngularJS discussion
this is what I tried but it is not working for me, maybe it might work for you?

Scott Logsdon

unread,
Feb 9, 2019, 9:39:17 AM2/9/19
to ang...@googlegroups.com
Double click to edit a cell.   To enable cell edit, add the attributes in your template HTML

<div id="grid-products" ui-grid="productsGrid" ui-grid-edit ui-grid-row-edit ui-grid-cellNav></div>

In the controller, 

        $scope.productsGrid = {
            data: [],
            enableHorizontalScrollbar: 0,
            enableVerticalScrollbar: 0,
            enableCellEdit: false,
            columnDefs: [{ field: 'id', displayName: 'Id', width: 100 },
                         { field: 'categoryName',  displayName: 'Category', enableCellEdit: true,  sort: { direction: 'asc', priority: 0 } },
                         { field: 'name',  displayName: 'Name', enableCellEdit: true  },
                         { field: 'txtPrice', displayName: 'Price', enableCellEdit: true  },
                         { field: 'taxable', displayName: 'Taxable', width: 100 , cellTemplate: 'app/components/Admin/restaurant/gridColumns/taxablePartial.html', enableSorting: false  },
                         { field: 'edit', displayName: ' ', width: 53 , cellTemplate: 'app/components/Admin/restaurant/gridColumns/btnEditProductPartial.html', enableSorting: false  },
                         { field: 'copy', displayName: ' ', width: 60 , cellTemplate: 'app/components/Admin/restaurant/gridColumns/btnCopyProductPartial.html', enableSorting: false  },
                         { field: 'remove', displayName: ' ', width: 30 , cellTemplate: 'app/components/Admin/restaurant/gridColumns/btnRemoveProductPartial.html', enableSorting: false  }
                       ],
            onRegisterApi: function(gridApi) {
                $scope.gridApi.products = gridApi;
                $scope.gridApi.products.grid.registerRowsProcessor( function(rows) {
                    return gridSingleFilter(rows, $scope.searchTerm.products, [ 'name', 'categoryName' ] );
                }, 200 );
                gridApi.rowEdit.on.saveRow($scope,  function( rowEntity ) {
                    var deferred = $q.defer();
                    gridApi.rowEdit.setSavePromise( rowEntity, deferred.promise );
                    if (rowEntity.id === undefined) {
                        MyService.GetProducts({ id: $routeParams.venueCode }).then(function(products){
                            var products = products.data;
                            products.post(rowEntity);
                        });
                    } else {
                        rowEntity.save();
                    }
                    deferred.resolve();
                });
            }
        };                


--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages