There is a native way to use this. This is a grid event and is called rowattr.
This event is called when the new grid row is inserted. It can be used to set additional style and class attributes of the row dynamically. The event should return a object something like this {"style" : "somestyle", "class": "someclass"}.
Parameters passed to this events are the: array with the row data to be inserted and currobjq – the row represenrd in its native format (json or xml)