Change row color of table dynamically

Hi Team,

I have searched the forums and read the documentation and cannot find a solution to my particular scenario, which is as follows:

I have a table object which I want to use alternating row colors on, and this works fine.

Now, in the same table I also want to color certain rows which are “in alarm” based upon the value in a particular column (time column) by product category. So, I have another table which has categories for inventory and the maximum amount of time an item in each category can sit in inventory before I color the row red. This is different for each category, of course, so a fixed numeric value in a mapping table will not suffice since multiple products show up in the table.

So, in the final analysis, I want to have alternating row colors as I currently do, but also if the row category shows that it has been sitting in inventory longer than the allowable time from the other table (I could make this into an invisible column in the table if needed) then it should be red instead of the alternating color scheme. Is this possible to combine the two somehow, or access individual background color properties and script this function?

yes you can definitely do this.

What you need to do is create another column in your table, integer datatype. you would then have that column hidden. in your script that populates the data you would put a value in that column which you would then use a background color mapping on the columns you want to change the color on. Then you build the background color list to match the colors that you need.

Thanks for the help! My table type is “alternating” though. Is there a way to set up both mapping and alternating?

yes, here is an example. we are using alternating but by using the background color mapping we can change individual cells(Normal = green background) or even whole rows(gas analysis = dark grey)based on that hidden column. I also attached the table setup.




Perfect - Thank you for the great example! I didn’t realize you could turn on individual mappings manually through that table customizer interface for individual cells…nice feature!

I take it though that we cannot access the backgroundcolor property of a row in the table object through scripting and set it via row index or some similar manner? I didn’t see any functions for this.

As of Ignition 7.6 there is a way to do this in scripting by implementing the Table component’s [tt]getBackgroundColorAt[/tt] extension function.