I am trying to figure out how to dynamically set enableCellEdit on a cell based on information in the row. For example, something like:
$scope.gridOpts = {
data: 'mydata',
columnDefs: [{field: 'sometimesIEdit', enableCellEdit:row.isEditable}]
}
Clearly row is not available in this context. Maybe enableCellEdit is evaluated purely at the column level and not the cell level making what I want to do impossible - I'm not sure.
I know that as a work around I can use editableCellTemplate with ng-if to show plain text, but I would rather the cell never go editable at all.
This is pretty old but figured I'd attempt to answer anyway. I had this exact same problem and solved it using the editableCellTemplate for that column. This is the template I used is something like this:
var editableCellTemplate = '<div class="email" ng-edit-cell-if="isFocused && '
+ 'row.entity.canEdit">'
+ '<input ng-class="\'colt\' + col.index" ng-input="COL_FIELD" '
+ 'ng-model="COL_FIELD" />'
+ '</div>'
+ '<div ng-edit-cell-if="isFocused">'
+ '<div class="ngCellText" ng-class="col.colIndex()"><span ng-cell-text>'
+ '{{COL_FIELD}}</span></div>'
+ '</div>'
+ '</div>';
So only if the row entity has canEdit equal to true can that cell be edited.