© 2026 LinearBytes Inc.
Search posts, tags, users, and pages
P Sivakumar
sivakumar
Hi,
I would like to add new row when user hits enter key in last column of ui-grid. Can anyone suggest me how to track the events on particular cell in ui-grid?
Mario Giambanco
Director of User Experience Development
I'm assuming your referring to this? http://ui-grid.info/
plnkr.co/edit/ZIxtMT1CiimrafiMIha4
To one of their examples - I added:
gridApi.edit.on.afterCellEdit($scope,function(rowEntity, colDef, newValue, oldValue){ $scope.addData(); })
to onRegisterApi
and
$scope.addData = function() { var n = $scope.gridOptions.data.length + 1; $scope.gridOptions.data.push({ "id": n }); };
Simply pushes a new object to the end of the dataset.
This will trigger on enter key of any row cell. Now figure out how to detect which cell was edited (hint: probably colDef)
Thank you so much.. :)
Mario Giambanco
Director of User Experience Development
I'm assuming your referring to this? http://ui-grid.info/
plnkr.co/edit/ZIxtMT1CiimrafiMIha4
To one of their examples - I added:
gridApi.edit.on.afterCellEdit($scope,function(rowEntity, colDef, newValue, oldValue){ $scope.addData(); })to onRegisterApi
and
$scope.addData = function() { var n = $scope.gridOptions.data.length + 1; $scope.gridOptions.data.push({ "id": n }); };Simply pushes a new object to the end of the dataset.
This will trigger on enter key of any row cell. Now figure out how to detect which cell was edited (hint: probably colDef)