# Generating new columns through different xml

**URL:** <https://discourse.nodered.org/t/generating-new-columns-through-different-xml/63035>\
**Category:** Dashboard\
**Created:** [25 May 2022 08:17 UTC](https://discourse.nodered.org/t/generating-new-columns-through-different-xml/63035 "2022-05-25T08:17:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Theo](https://avatars.discourse-cdn.com/v4/letter/t/a87d85/32.png) [@Theo](https://discourse.nodered.org/u/Theo)\
**Post date:** [25 May 2022 08:17 UTC](https://discourse.nodered.org/t/generating-new-columns-through-different-xml/63035/1 "2022-05-25T08:17:52Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![kvramji](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kvramji/32/59005_2.png) [@kvramji](https://discourse.nodered.org/u/kvramji)\
**Post date:** [2 June 2022 05:25 UTC](https://discourse.nodered.org/t/generating-new-columns-through-different-xml/63035/2 "2022-06-02T05:25:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Theo](https://avatars.discourse-cdn.com/v4/letter/t/a87d85/32.png) [@Theo](https://discourse.nodered.org/u/Theo)\
**Post date:** [2 June 2022 06:07 UTC](https://discourse.nodered.org/t/generating-new-columns-through-different-xml/63035/3 "2022-06-02T06:07:05Z")

</div>

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

```auto
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;

```

---

<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:** [2 July 2022 06:07 UTC](https://discourse.nodered.org/t/generating-new-columns-through-different-xml/63035/4 "2022-07-02T06:07:28Z")

</div>

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