# Set background color of row ui table for different data

**URL:** <https://discourse.nodered.org/t/set-background-color-of-row-ui-table-for-different-data/68231>\
**Category:** Dashboard\
**Created:** [26 September 2022 09:41 UTC](https://discourse.nodered.org/t/set-background-color-of-row-ui-table-for-different-data/68231 "2022-09-26T09:41:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Kimo](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@Kimo](https://discourse.nodered.org/u/Kimo)\
**Post date:** [26 September 2022 16:13 UTC](https://discourse.nodered.org/t/set-background-color-of-row-ui-table-for-different-data/68231/2 "2022-09-26T16:13:40Z")

</div>

I tried to apply line of codes below as what I read on [Examples for node-red-node-ui-table - #85 by deme](https://discourse.nodered.org/t/examples-for-node-red-node-ui-table/14256/85)

```auto
var key = Object.keys(msg.payload[0]);
var arr = [];
var col = [];

for(i = 0; i <key.length; i++){
    arr = {
        "title": key[i],
        "field": key[i],
        "headerFilter": "input"
    }
    col.push(arr)
}

msg.ui_control = 
{
    "tabulator": {
        "columns": col,
        
        "rowFormatter": "function(row){ var data = row.getData(); switch (data.$Hand Size) { case \"7\": row.getElement().style.backgroundColor = \"#B48439\"; row.getElement().style.color = \"#B48439\"; break;}}",
        
    }
}
return msg;

```

Basically I just add the last line of rowFormatter to catch data from sql and if the Hand Size column is 7, it will have background color as mentioned. However, the data on table no longer appear.  
Any help will greatly appreciated. Thank you

---

_[View the full topic](https://discourse.nodered.org/t/set-background-color-of-row-ui-table-for-different-data/68231)._
