Ui-table Need help

Hi i need serius help now, before i loose my sanity. i have a flow with two function nodes one sends msg.ui-control for setting up a tabulator table. that works fine . the other sends am objectarray for data, and that is displayed fine, the probleme comes when i need to convart data in a cell based on the showed params, i have attached function node configuration. i am general in doubt where to put code for farmattin the table and also callback when i click a cell. please pin it out for a dumas :-).

function customFormatter(cell, formatterParams, onRendered) {
    // Your formatter logic here
    return "Formatted Value"; // Replace "Formatted Value" with your actual formatted value
}
msg.ui_control = 
    {
        
   tabulator: {
        columnResized: "function(column){     var newColumn = {         field: column._column.field, visible: column._column.visible,         width: column._column.width,         widthFixed: column._column.widthFixed,         widthStyled: column._column.widthStyled     }; this.send({topic:this.config.topic,ui_control:{callback:'columnResized',columnWidths:newColumn}}); }",
            columnMoved: "function(column, columns){     var newColumns=[];     columns.forEach(function (column) {         newColumns.push({'field': column._column.field});     });     this.send({topic:this.config.topic,ui_control:{callback:'columnMoved',columns:newColumns}}); }",
                groupHeader: "function (value, count, data, group) {return value + \"<span style='color:#d00; margin-left:10px;'>(\" + count + \" Termostat\"+((count>1) ? \"e\" : \"\") + \")</span>\";}",
                    columns: [
                        {
                            formatterParams: {
                                target: "_blank"
                            },
                            title: "Header",
                            field: "Header",
                            width: 100,
                            frozen: true
                        },
                        {
                            formatterParams: {
                                
                                ranges: [
                                    { "min": 153910001, "max": 153905000, "text": "EcHo Plus DK WH" },
                                    { "min": 154000000, "max": 154005000, "text": "EcHo Plus EU WH" },
                                ]
                            },
                            title: "S.nr",
                            field: "SN",
                            width: 100,
                            align: "center",
                            formatter: function(cell, formatterParams) { 
                                console.log('Formatter function called'); 
                                var serialNumber = cell.getValue(); 
                                var match = serialNumber.toString().match(/\\d{2}(\\d+)/); 
                                if (match) { 
                                    var digitsAfterFirstTwo = parseInt(match[1]); 
                                    for (let range of formatterParams.ranges) { 
                                        if (digitsAfterFirstTwo >= range.min && digitsAfterFirstTwo <= range.max) { 
                                            return range.text; 
                                        } 
                                    } 
                                } 
                            return serialNumber+"lp"; 
                            }          
                        },
                        {
                            formatterParams: {
                                "target": "_blank"
                            },   
                            title: "Location ",
                            field: "unitloc",
                            width: 100,
                            align: "left",
                            formatter: function(cell, formatterParams){return cell.getValue()+"°C";}
                            
                        },
                       
                        {
                            formatterParams: {
                                target: "_blank"
                            },
                            title: "SWver",
                            field: "SWver",
                            width: 100,
                            align: "center"
                        },
                        {
                            formatterParams: {
                                target :"_blank"
                            },
                            title: "HWV",
                            field: "HWV",
                            width: 100,
                            align: "center"
                        },
                        {
                            formatterParams: {
                                target: "_blank"
                            },
                            title: "Network",
                            "columns": [
                                {
                                    formatterParams: {
                                        target: "_blank"
                                    },
                                    title: "IP",
                                    field: "IP",
                                    width: 125
                                },
                                {
                                    formatterParams: {
                                        target: "_blank"
                                    },
                                    title: "DHCP",
                                    field: "DHCP",
                                    width: 125
                                }
                            ]
                        },
                        {
                            formatterParams: {
                                target: "_blank"
                            },
                            title: "Projector timers Settings",
                            columns: [
                                {
                                formatterParams: {
                                        target: "_blank"
                                    },
                                    title: "Lamp timer",
                                    field: "TimerVal",
                                    width: 150
                                },
                                {
                                    formatterParams: {
                                        target: "_blank"
                                    },
                                    title: "Filter timer",
                                    field: "FilterTimer",
                                    width: 150,
                                    align: "center"
                                }
                            ]
                        },
                        {
                        formatterParams: {
                                "target": "_blank"
                            },
                            title: "Panel description ",
                            field: "UnitDSC",
                            width: 250,
                            align: "left"
                        }
                    ],
                        layout: "fitColumns",
                            movableColumns: true,
                                "groupBy": ""
    },
    "customHeight": 25
}



return msg;


Ive got it to work thaks if any answers

1 Like

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