diff --git a/misc/tutorial/201_editable.ngdoc b/misc/tutorial/201_editable.ngdoc index 42a33614d0..6ea49d5a02 100644 --- a/misc/tutorial/201_editable.ngdoc +++ b/misc/tutorial/201_editable.ngdoc @@ -44,7 +44,7 @@ __ColumnDef Options__: - `enableCellEdit` (default: `false` for columns of type `'object'`, `true` for all other columns) - `true` will enable editing and `false` will disable it. - `cellEditableCondition` (default: `true`) Can be set to a boolean or a function that will be called with the cellScope - to determine if the cell should be invoked in edit mode. + and triggerEvent to determine if the cell should be invoked in edit mode. - `type` (default: `'string'`) If set to `'number'`, `'boolean'` or `'date'` the default editor provided for editing will be numeric or boolean or date editor respectively. If set to `'object'` the column will not be editable by default. Be aware that this `type` column is also used for other purposes within ui-grid, including the sorting logic. diff --git a/src/features/edit/js/gridEdit.js b/src/features/edit/js/gridEdit.js index 550e46fbc6..7560e5dd66 100644 --- a/src/features/edit/js/gridEdit.js +++ b/src/features/edit/js/gridEdit.js @@ -147,8 +147,8 @@ * If false, then editing of cell is not allowed. * @example *
- * function($scope){ - * //use $scope.row.entity and $scope.col.colDef to determine if editing is allowed + * function($scope, triggerEvent){ + * //use $scope.row.entity, $scope.col.colDef and triggerEvent to determine if editing is allowed * return true; * } *@@ -209,8 +209,8 @@ * @description If specified, either a value or function evaluated before editing cell. If falsy, then editing of cell is not allowed. * @example *
- * function($scope){ - * //use $scope.row.entity and $scope.col.colDef to determine if editing is allowed + * function($scope, triggerEvent){ + * //use $scope.row.entity, $scope.col.colDef and triggerEvent to determine if editing is allowed * return true; * } *@@ -592,10 +592,10 @@ } } - function shouldEdit(col, row) { + function shouldEdit(col, row, triggerEvent) { return !row.isSaving && ( angular.isFunction(col.colDef.cellEditableCondition) ? - col.colDef.cellEditableCondition($scope) : + col.colDef.cellEditableCondition($scope, triggerEvent) : col.colDef.cellEditableCondition ); } @@ -732,7 +732,7 @@ return; } - if (!shouldEdit($scope.col, $scope.row)) { + if (!shouldEdit($scope.col, $scope.row, triggerEvent)) { return; }