Rendering a cell of a data grid with different colors based on what's in the cell.

Seong shared this question 5 years ago


Is it possible to render a cell of certain data with different color depending on data within a cell?

For example, I have a set of priorities such as Urgent, High, Medium, Low

and I want the cells of these texts to be rendered with different colors, red/yellow etc.

At the moment I added a condition like when ((data) has (urgent)) render the cell with red but it doesn't work...

Comments (3)


Hello, it's gonna be tricky. The normal thing JIMP expects is to change the color for highlighting selected row. For achieving this you must add the following 2 actions:


Change Style on Datagrid (just select the whole datagrid, select background but don't change anything at all)

Change Style on Row_1 (or whatever the Datagrid cell is named).

For the coloring according to state or something, I had very complicated days to make it work somehow. It's more a workaround than a real solution and it costs performance and some weird behavior.

You can put a hidden 1x1 px input or use any of the inputs where you have a value on the datagrid row and then create a change style for a focus in event.

Then you must trigger such focus on the row from outside the datagrid. I can be via OnpageLoaded or on the click a a button that makes the list appear or something.

By doing this when JIMP is iterating on the list values the focus will be triggered for every one of them because de name Id of all of them are the same. So you'll see the list to scroll till the last element beacause that's the last one the focus was put in.

In order to get back to the beginning of the list you must set focus on another element outside the datagrid or even the datagrid Label row tha is supposed to be at the beginning of the list. Th weird thing you'll gonna se is the list scrolling upwards after have scrolled downwards.

Hope you get the idea of my workaround and if you find some claener and elegant way of doing it the please share it!! :)


Thanks for helping Seong, mogarick!


Thanks Mogarick. I appreciate your effort.