0

I have a nggrid with a name and an age column with some data.

so it looks like this:

Name | Age
50 | 50 : age field has green background because name and age col have same value

How can I make the age column editable/noneditable depending on the namecolumn value in this row?

see also: http://plnkr.co/edit/OxJqS5LYOvG2vx0Ujhu7?p=preview

Pindakaas
  • 4,389
  • 16
  • 48
  • 83
  • why not just use the enableCellEdit or enableCellEditOnFocus in your nggrid options? does the requirement insist on only making it editable when there is an issue? – Mark-Sullivan Feb 26 '14 at 23:54
  • I need to have this age column disabled ie enableCellEdit=false, but this does not work: enableCellEdit:row.getProperty(col.field) == row.getProperty('name') see updated plunkr: http://plnkr.co/edit/jFKJvC7ShAiN95ro0Tz0?p=preview – Pindakaas Feb 27 '14 at 02:27

1 Answers1

1

You can use cellEditableCondition on a per-column basis within the columnDefs like so:

cellEditableCondition: 'row.getProperty(\'name\') == row.getProperty(\'age\')'

See Plunker here. If you want to control editing on a per-row basis, move cellEditableCondition out of the columnDefs and into the gridOptions.

Geoff
  • 495
  • 3
  • 12