0

I want to enable cell edit based on row index

columnDefs: [
{
field: "Name",
name: "Name",
enableCellEdit: true,
cellEditableCondition: 'row.rowIndex == 2',
cellTemplate: '<div class="ui-grid-cell-contents">{{}}</div>'
}

but above code is not working. If i pass true in cellEditableCondition it works fine. I think row.rowIndex is not giving index. I was able to get row index in cell template as below, but if i write same code in cellEditableCondition it wont work.

field: "Name",
name: "Name",
enableCellEdit: true,
cellEditableCondition: 'grid.renderContainers.body.visibleRowCache.indexOf(row) == 2', // not working
cellTemplate: '<div class="ui-grid-cell-contents">{{grid.renderContainers.body.visibleRowCache.indexOf(row)}}</div>' //working

Please help me to get rowindex in cellEditableCondition

apps
  • 313
  • 1
  • 7
  • 17
  • Try this: http://stackoverflow.com/a/29637408/5954939, If you'll need more assistance, let me know. – AranS Jun 14 '16 at 06:15

1 Answers1

0

You should pass a function like this -

cellEditableCondition:
    function($scope) {        
      return $scope.grid.renderContainers.body.visibleRowCache.indexOf($scope.row) == 2;
    }
Pratik Bhat
  • 7,166
  • 2
  • 35
  • 57