# Get data from ui table

**URL:** <https://discourse.nodered.org/t/get-data-from-ui-table/62334>\
**Category:** Dashboard\
**Created:** [7 May 2022 12:35 UTC](https://discourse.nodered.org/t/get-data-from-ui-table/62334 "2022-05-07T12:35:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![webguy16](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/webguy16/32/59038_2.png) [@webguy16](https://discourse.nodered.org/u/webguy16)\
**Post date:** [7 May 2022 12:35 UTC](https://discourse.nodered.org/t/get-data-from-ui-table/62334/1 "2022-05-07T12:35:20Z")

</div>

> [@Get data from ui\_table](https://discourse.nodered.org/t/get-data-from-ui-table/41440):
>
> Hi there, I am trying to pass the data displayed in the ui\_table to the payload. I have tried to use tabulator's table.getData() command but I didn't manage to get any result in the payload. I am sending the command this way: msg.payload={ command:"getData", arguments: , } Any help about this issue? Thanks in advance, Aitor

> [@Get ui-table data in JSON format](https://discourse.nodered.org/t/get-ui-table-data-in-json-format/55262):
>
> Hi nodered experts, I have ui Table where I can add/edit or delete any cells or rows. Once the user is done adding/editing or deleting, I want to store the table data on a variable (might be global or flow) in JSON format. I found this the same question here in forum: However, this works only when you only want to edit data on your table. What I want to achieve is, regardless of the user did to table (add/edit or delete row), after that, there is a button that when I pressed, it will save t…

While i found those two other posts apparently asking my same question, the answers given both involve strange work arounds and apparent confusion over the question or node they are using and are answering as if they are using the "ui-table-handler" node instead of just using the ui-table node like the questions asked. I was just hoping to get some clarification as to whether the ui-table node getData() command that is built into tabulator is broken or if it's not a 'command' in the same way that commands like 'download' are. The tabulator documentation says that "var data = table.getData("active"); //return currently filtered data" and i've used other tabulator commands (like the download one) in this manner successfully, im just not sure how to format this one or if it even 'works' the same way. Ways i've tried below...

msg.payload = {  
"command": 'table.getData("active")'  
}

msg.payload = {  
command: '.getData("active")'  
}

msg.payload = {  
command: 'getData("active")'  
}

msg.payload = {  
"command": 'table.getData("")'  
}

msg.payload = {  
"command": "table.getData()"  
}

msg.payload = {  
"command": "table.getData"  
}

msg.payload = {  
"command": ".getData()"  
}

msg.payload = {  
"command": "getData()"  
}

msg.payload = {  
"command": "getData('active')"  
}

msg.payload = {  
"command": "getData"  
}

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [8 May 2022 05:43 UTC](https://discourse.nodered.org/t/get-data-from-ui-table/62334/2 "2022-05-08T05:43:52Z")

</div>

Although I don't use the subflow, nor have any experience with it. Reading the mentioned topics, this seems to be the correct way:

`msg.payload = { "command": "getData" }`

The output comes from the secondary port on the node. Did you connect a debug node on that one ?

---

<div class="post-metadata">

**Author:** ![webguy16](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/webguy16/32/59038_2.png) [@webguy16](https://discourse.nodered.org/u/webguy16)\
**Post date:** [9 May 2022 13:42 UTC](https://discourse.nodered.org/t/get-data-from-ui-table/62334/3 "2022-05-09T13:42:26Z")

</div>

"...as if they are using the "ui-table-handler" node instead of just using the ui-table node like the questions asked."

Thanks for your time but you appear to be talking about the 'ui-table-handler' node since the ui-table node does not have a secondary port.

---

<div class="post-metadata">

**Author:** ![webguy16](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/webguy16/32/59038_2.png) [@webguy16](https://discourse.nodered.org/u/webguy16)\
**Post date:** [22 May 2022 14:34 UTC](https://discourse.nodered.org/t/get-data-from-ui-table/62334/4 "2022-05-22T14:34:12Z")

</div>

I ended up doing it a different way since i couldn't figure out how to send the command correctly. I added the below code to the ui\_control.tabulator ...object?. Anyway it appears to be doing what i want it to, sending back all the data shown in the table after it's been filtered. Thought i'd leave this here in case it is helpful to anyone else trying to do the same.

```
"dataFiltered":"function(filters, rows){let data = []; for(i=0; i<rows.length; i++){data.push(rows[i].getData())}; this.send({ui_control:{callback:'dataFiltered'}, payload:data});}" ,
"movableColumns": true //just showing that it's in the same place this one goes
```

---

<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:** [5 June 2022 14:34 UTC](https://discourse.nodered.org/t/get-data-from-ui-table/62334/5 "2022-06-05T14:34:34Z")

</div>

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