0
votes

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

1
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
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: plnkr.co/edit/jFKJvC7ShAiN95ro0Tz0?p=previewPindakaas

1 Answers

1
votes

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.