I have an ngGrid with some individual cells (not columns) that I don't want to be edited. In my example plunk I want to not edit the cells where the row and column index are the same.
I tried preventDefault()
, event.stopPropagation()
, and an old fashioned return false;
in my ngGridEventStartCellEdit
but the cell still enters edit mode.
$scope.$on('ngGridEventStartCellEdit', function (event) {
var row = event.targetScope.row.rowIndex;
var col = event.targetScope.col.index - 1;
if (row == col) {
console.log("Not Gonna propagate");
event.preventDefault();
event.stopPropagation();
return false;
}
});
The console.log("Not Gonna propagate");
fires. What am I doing wrong?
I tried using cellEditableCondition
.
Here's the plunker with it. All you need is :
enableCellEdit: true,
cellEditableCondition: 'row.rowIndex !== col.index',
enableCellEdit has to be true
for the editable condition to work.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments