如何在nggrid列中禁用?

时间:2014-02-26 23:52:28

标签: angularjs ng-grid

我正在尝试禁用celledit以获取nggrid中的列:

$scope.gridOptions = { 
  data: 'myData', 
  enableCellSelection: true,
  enableCellEditOnFocus:true,
  enableRowSelection: false,
  columnDefs: [{field: 'name', displayName: 'Name', enableCellEdit: true}, 
  {field:'age', displayName:'Age',
  cellTemplate: '<div ng-disabled=true ng-class="{green: row.getProperty(col.field) == row.getProperty(\'name\'),red:row.getProperty(col.field) != row.getProperty(\'name\')}"><div style="text-align:center;"                    class="ngCellText">{{row.getProperty(col.field)}}</div></div>'}]
};

我尝试过ng-disabled = true但它不起作用?这该怎么做? plunkr:http://plnkr.co/edit/nj57V6WcHJxN5OosvwYx?p=preview

1 个答案:

答案 0 :(得分:0)

您可以尝试使用enableCellEdit: false吗?

columnDefs: [{field: 'name', displayName: 'Name', enableCellEdit: false},