0
votes

I have been trying to figure out a way to change the class of cells which have been edited so that I can style yjr, as being dirty.

Using 'editableCellTemplate', I can't seem to make ng-change fire. So next I've been playing around with cellTemplate but not really having any luck.

Anyone figure out a way to mark a cell dirty after an edit in ng-grid?

Couple of related questions;

1) Can you get the row index using row.getProperty method?

2) Can you fire ng-change from an entiableCellTemplate?

TIA

1

1 Answers

0
votes

Found a way to mark a cell dirty by using a duplicate array to hold the original data and then compare that against the cell data.

Not pretty but it works. Maybe someone can come up with a better solution.

So here is my hack solution.

cellTemplate : '<div class="ngCellText" ng-class="{\'dirtyItem\' : row.entity.Price != myData.items[myData.itemsSm.indexOf(row.entity)].Price}">'
      + '<span ng-cell-text>{{COL_FIELD}}</span></div>'

So this is a cell template for 'Price' column where I set the class to 'dirtyItem' if the cell Price valuedoes not match the original Price.