I had a request to highlight rows which have been changed in a SlickGrid, a simple task one might think. It turns out that it is indeed quite easy. However, this is SlickGrid we’re talking about so as usual the relevant documentation is somewhat difficult to track down.
All you really need to do is mark a row as ‘dirty’ and apply a CSS class to the row accordingly. First up that requires a CSS class to apply, I called mine
dirty and it sets the row’s background colour:
You apply the CSS class to a row using SlickGrid’s
getItemMetadata function (note I’m using a DataView):
You also need to mark a row as dirty when it changes, you do this with the
That’s all there is to it. Mark a row as dirty when one of it’s cells changes, apply CSS, job done.