Examples for node-red-node-ui-table

Another issue I came across: according to the tabulator doc's, it should be possible to change the color of a row depending on some column's value:

msg.payload = [{"time": 1, "value":true}, {"time":2, "value": false}, {"time":3, "value": true}];

columns = [
{   
        title:"Time",       
        field:"time",      
        width:190,      
        align:"left", 
        headerSortStartingDir:"desc"
    },
    {
        title:"Status",            
        field:"value",          
        width:250,       
        align:"center", 
        headerSort:false
}]

msg.ui_control = {};
msg.ui_control.tabulator = {
    "placeholder":"empty",
    "columns":columns,
    "pagination":"local",
    "paginationSize":20,
    "initialSort":[
        {column:"timestamp", dir:"desc"}
    ],
    "rowFormatter":function(row){
        var data = row.getData();

        if(data.value === true){
            row.getElement().style.backgroundColor = "#A6A6DF";
            row.getElement().style.color= "#FF0000";
        } 
    }
}

Unfortunately, this does not work for me - anyone who got this to work?

1 Like