Make only some cells editable in ngGrid?

I have an ngGrid that shows several records mainly with the contents of key / value . Now I would like to make some of these entries editable.

Using the enableCellEditing ngGrid functions, I can enable or disable editing for a full column, but what if I only want to enable it for some rows in this column? Is there a way to dynamically tune this for each row?

+6
source share
3 answers

Late answer, but ng-grid (which is now redone as ui-grid ) now has cellEditableCondition , which can be used to edit only some cells.

Just add it to your gridOptions :

 enableCellEditOnFocus: true, cellEditableCondition: 'row.rowIndex !== 2' //can edit all rows except for the third 

Plunker example

This feature is only available after ng-grid 2.0.9

+3
source

You can use cellEditableCondition as below code

{field: 'planTypeName', displayName: $ rootScope.commonProperty.name, enableCellEditOnFocus: true, enableCellEdit: true, cellEditableCondition: function ($ scope) {return $ scope.row.entity.sts == 'A'; }},

0
source

How do I stop editing the last row using CellEditableCondition?

0
source

Source: https://habr.com/ru/post/958991/


All Articles