Generating new columns through different xml

I have a problem with the ui_table. My table is generated dynamically, but I want to make each row editable ("editor":"input"). So far I know, it is only possible if you precise which column you want to make selectable, but this is not possible in my case, because I don´t know in advance what will be the name of the columns. Is there a solution?

If the column name is dynamically send via a payload to the ui_table node, you can see what sub part of the msg.payload holds the column names. Since that would be dynamically coming into your table.

Can you share your flow or screenshot of the flow?

I found a way to solve the issue with a loop to make every column with "input". I don´t know if this is the most effectiv solution, but it worked at least

var oneKey = Object.keys(msg.payload[0])[0];
msg.oneKey=oneKey;
keys = (Object.keys(msg.payload[0]));
msg.keys=keys;
var nextIndex = keys.indexOf(oneKey);
var  nextItem = keys[nextIndex];

msg.CSSPayload = [];

for (var i = 0; i < Object.keys(msg.payload[0]).length; i++)
{
oneKey = Object.keys(msg.payload[0])[i];

msg.JSonTest = {"title":oneKey,
"field" : oneKey,
"editor":"input"}
msg.CSSPayload.push(msg.JSonTest);
}
 
msg.keys= nextItem;
msg.ui_control =  {
     "tabulator": {
        "columns": msg.CSSPayload ,
        
        "movableColumns": true,
        "resizableColumns": true,
        "headerVisible": true,
        "headerSort": false,
        "selectable": true
    }
}

return msg;

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