Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updateOrAddData in Table not working #39

Open
1 task
derFrickler opened this issue Sep 8, 2020 · 2 comments
Open
1 task

updateOrAddData in Table not working #39

derFrickler opened this issue Sep 8, 2020 · 2 comments

Comments

@derFrickler
Copy link

Which node are you reporting an issue on?

ui-table

What are the steps to reproduce?

send this message to table:

{"command":"updateOrAddData","arguments":[{"linkquality":2,"name":"Router_KG","id":1}]}

What happens?

No Row is added to the table, the Browser shows the following error:

Uncaught (in promise) TypeError: data.forEach is not a function
updateOrAddData http://homeserver:1880/ui/#!/0#/0 line 20 > injectedScript:8221
updateOrAddData http://homeserver:1880/ui/#!/0#/0 line 20 > injectedScript:8207
http://homeserver:1880/ui/js/app.min.js line 571 > eval:145
$digest http://homeserver:1880/ui/js/app.min.js:172
$apply http://homeserver:1880/ui/js/app.min.js:176
r http://homeserver:1880/ui/js/app.min.js:190
completeTask http://homeserver:1880/ui/js/app.min.js:187
d http://homeserver:1880/ui/js/app.min.js:73
setTimeout handler*Ag/h.defer http://homeserver:1880/ui/js/app.min.js:72
f http://homeserver:1880/ui/js/app.min.js:190
t http://homeserver:1880/ui/js/app.min.js:569
emit http://homeserver:1880/ui/socket.io/socket.io.js:6
onevent http://homeserver:1880/ui/socket.io/socket.io.js:8
onpacket http://homeserver:1880/ui/socket.io/socket.io.js:8
exports http://homeserver:1880/ui/socket.io/socket.io.js:8
emit http://homeserver:1880/ui/socket.io/socket.io.js:6
ondecoded http://homeserver:1880/ui/socket.io/socket.io.js:6
exports http://homeserver:1880/ui/socket.io/socket.io.js:8
emit http://homeserver:1880/ui/socket.io/socket.io.js:6
add http://homeserver:1880/ui/socket.io/socket.io.js:6
ondata http://homeserver:1880/ui/socket.io/socket.io.js:6
exports http://homeserver:1880/ui/socket.io/socket.io.js:8
emit http://homeserver:1880/ui/socket.io/socket.io.js:6
onPacket http://homeserver:1880/ui/socket.io/socket.io.js:6
setTransport http://homeserver:1880/ui/socket.io/socket.io.js:6
emit http://homeserver:1880/ui/socket.io/socket.io.js:6
onPacket http://homeserver:1880/ui/socket.io/socket.io.js:7
onData http://homeserver:1880/ui/socket.io/socket.io.js:7
onmessage http://homeserver:1880/ui/socket.io/socket.io.js:8

What do you expect to happen?

Row should be added or replaced in the table.

Please tell us about your environment:

  • [ 1.1.03] Node-RED version:
  • [v10.22.0 ] node.js version:
  • npm version:
  • [Ubuntu Linux] Platform/OS:
  • [ Firefox] Browser:

Might be the same as there: https://stackoverflow.com/questions/53275405/typeerror-data-foreach-is-not-a-function/53275463
Meaning the data object needs to be parsed on arrival, but no Idea on where to add this.

@Christian-Me
Copy link
Contributor

Hi @derFrickler

sorry I haven't spotted your issue.

Think I spotted your problem.

UpdateOrAddData expects an array as you can add multiple clees / lines in one command. Arguments is an array of arguments itself. So:

{"command":"updateOrAddData",
  "arguments":[
    [
      {"linkquality":2,"name":"Router_KG","id":1}
    ]
  ]
}

should work. ui-table does not perform a validation of commands and parameters.

As a "testbench" you can use the Example "4 Sending Commands"

image

@andersea
Copy link

andersea commented Jan 8, 2021

I had a similar issue with the replaceData function. It wasn't obvious to me that I needed to encapsulate the data in another array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants