# Ui-table, msg.ui\_control formatters

**URL:** https://discourse.nodered.org/t/ui-table-msg-ui-control-formatters/77816
**Category:** Dashboard
**Tags:** node-red-dashboard
**Created:** [22 April 2023 11:47 UTC](https://discourse.nodered.org/t/ui-table-msg-ui-control-formatters/77816 "2023-04-22T11:47:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![PLCMercenary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/plcmercenary/32/48855_2.png) [@PLCMercenary](https://discourse.nodered.org/u/PLCMercenary)
#### Post date: [22 April 2023 11:47 UTC](https://discourse.nodered.org/t/ui-table-msg-ui-control-formatters/77816/1 "2023-04-22T11:47:31Z")

</div>

Hello all,

I am looking for advice with using the node-red-node-ui-table node. I would like to set the BG color of cells in a column that have the value of true. I cannot seem to find the correct formatter or the formatters that are available dont seem to work in the way I expect. using this function to set the column params in a msg.ui\_control field does not seem to do anything at all.

```auto
msg.ui_control = {tabulator: {columns:[  
    {
        "field": "vals",
        "width": "30%",
        "editor": false,
        "formatter": "function(cell, formatterParams){ var value = cell.getValue(); if (value === false) { cell.getElement().css({ 'background-color': '#D31772' }); } return value; }"
    } 
]
}
}
node.send(msg)
return ;

```

---

<div class="post-metadata">

### Author: ![PLCMercenary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/plcmercenary/32/48855_2.png) [@PLCMercenary](https://discourse.nodered.org/u/PLCMercenary)
#### Post date: [23 April 2023 04:01 UTC](https://discourse.nodered.org/t/ui-table-msg-ui-control-formatters/77816/2 "2023-04-23T04:01:55Z")

</div>

Finally found an example that I was able to make sense of. Or maybe taking a break and coming back to it and the formatters and examples are clearer to me.. either way. this works  
 ![CleanShot 2023-04-22 at 23.01.01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/7/c73dd7850ef16b20ea26e62ba53e753d4a5ca852.png)

```auto
msg.ui_control = {
    tabulator: {
        headerVisible: false,
        rowFormatter: (function (row) {
            const data = row.getData();
            if (data.vals) {
                row.getElement().style.backgroundColor = 'red';
            } else {
                row.getElement().style.backgroundColor = '';
            }
        }).toString(),
        columns: [
            {
                field: "vals",
                width: "30%",
                editor: false,
            }
        ]
    }
};

msg.payload = null;
node.send(msg);
return;

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [7 May 2023 04:02 UTC](https://discourse.nodered.org/t/ui-table-msg-ui-control-formatters/77816/3 "2023-05-07T04:02:34Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
