Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make only some cells editable in ngGrid?

I have an ngGrid that shows a few records with basically key / value content. Now, I would like to make some of these records editable.

Using the enableCellEditing features of ngGrid, I can enable or disable editin for a complete column - but what if I only want to enable it for some rows in that column? Is there any way to dynamically configure this for each row?

like image 939
Golo Roden Avatar asked Nov 28 '13 14:11

Golo Roden


1 Answers

Late answer, but ng-grid (which is now being redone as ui-grid) now has a cellEditableCondition that you can use to make only some cells editable.

You just add it in your gridOptions :

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

Example plunker

This feature availble only after ng-grid 2.0.9

like image 195
Goodzilla Avatar answered Oct 29 '22 19:10

Goodzilla