Node-red-ui-table don't refresh automatically

Hi, I try to make a table on my dashboard with the next nodes :

[
    {
        "id": "2f67ebdfe05368a8",
        "type": "ui_table",
        "z": "3e87841836f07711",
        "group": "475b1ea5d099553a",
        "name": "",
        "order": 9,
        "width": "12",
        "height": "5",
        "columns": [
            {
                "field": "Name",
                "title": "Groepsnaam",
                "width": "",
                "align": "left",
                "formatter": "plaintext",
                "formatterParams": {
                    "target": "_blank"
                }
            },
            {
                "field": "Speeltijd",
                "title": "Speeltijd",
                "width": "",
                "align": "left",
                "formatter": "plaintext",
                "formatterParams": {
                    "target": "_blank"
                }
            },
            {
                "field": "Straftijd",
                "title": "Straftijd",
                "width": "",
                "align": "left",
                "formatter": "plaintext",
                "formatterParams": {
                    "target": "_blank"
                }
            }
        ],
        "outputs": 0,
        "cts": false,
        "x": 790,
        "y": 280,
        "wires": []
    },
    {
        "id": "7efafbb18d1f7f81",
        "type": "function",
        "z": "3e87841836f07711",
        "name": "vul eindespel score",
        "func": "var tabledata = global.get(\"savedata\") ||[];\n\nvar t = global.get(\"timeElapsed\") / 1000; //ms naar sec\nvar h = Math.floor(t / 3600);\nvar m = Math.floor(t % 3600 / 60);\nvar s = Math.floor(t % 3600 % 60);\nvar formattijd = (\"0\" + h).slice(-2) + \":\" + (\"0\" + m).slice(-2) + \":\" + (\"0\" + s).slice(-2);\n\ntabledata.unshift({\n        \"Name\": \"pepe\",\n        \"Speeltijd\": formattijd,\n        \"Straftijd\": global.get(\"Straftijd\")\n        });\n\nmsg.payload = tabledata;\n\nglobal.set(\"savedata\", tabledata);\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 550,
        "y": 300,
        "wires": [
            [
                "2f67ebdfe05368a8"
            ]
        ]
    },
    {
        "id": "84fce77886d70f14",
        "type": "change",
        "z": "3e87841836f07711",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "savedata",
                "pt": "global",
                "to": "[]",
                "tot": "json"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 240,
        "wires": [
            [
                "2f67ebdfe05368a8"
            ]
        ]
    },
    {
        "id": "846d8fd7b5dd34e6",
        "type": "inject",
        "z": "3e87841836f07711",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 320,
        "y": 300,
        "wires": [
            [
                "7efafbb18d1f7f81"
            ]
        ]
    },
    {
        "id": "baeef06c6f68d64e",
        "type": "inject",
        "z": "3e87841836f07711",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 320,
        "y": 240,
        "wires": [
            [
                "84fce77886d70f14"
            ]
        ]
    },
    {
        "id": "475b1ea5d099553a",
        "type": "ui_group",
        "name": "Eindscore",
        "tab": "6c20ebed9219bf3d",
        "order": 1,
        "disp": true,
        "width": "12",
        "collapse": false,
        "className": ""
    },
    {
        "id": "6c20ebed9219bf3d",
        "type": "ui_tab",
        "name": "Eindscore",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

If I push on one inject node, the table is cleared and I see that immediately in the table on screen.
If I push then on the other inject node, then the first line comes immediately in the table on screen.
If I push a second time to add an extra line, then nothing happens on screen.
If I refresh the browser, then I can see the second line.
Why is the screen not refreshed the second time?

What did I wrong?

Once you send data to the table you need to use commands to update it with new data.
There are plenty of examples flows, which you can access from the editor.
menu > import > examples > ui-table

You can update the whole table using replaceData or you can add rows as shown in the editor examples.

here is an example of replacing the whole data set, as that is what you are attempting in your example flow.

[{"id":"2f67ebdfe05368a8","type":"ui_table","z":"d1395164b4eec73e","group":"475b1ea5d099553a","name":"","order":9,"width":"12","height":"5","columns":[{"field":"Name","title":"Groepsnaam","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"Speeltijd","title":"Speeltijd","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"Straftijd","title":"Straftijd","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":630,"y":160,"wires":[]},{"id":"7efafbb18d1f7f81","type":"function","z":"d1395164b4eec73e","name":"vul eindespel score","func":"var tabledata = global.get(\"savedata\") ||[];\n\nvar t = global.get(\"timeElapsed\") / 1000; //ms naar sec\nvar h = Math.floor(t / 3600);\nvar m = Math.floor(t % 3600 / 60);\nvar s = Math.floor(t % 3600 % 60);\nvar formattijd = (\"0\" + h).slice(-2) + \":\" + (\"0\" + m).slice(-2) + \":\" + (\"0\" + s).slice(-2);\n\ntabledata.unshift({\n        \"Name\": \"pepe\",\n        \"Speeltijd\": formattijd,\n        \"Straftijd\": global.get(\"Straftijd\")\n        });\n\nmsg.payload = {\n    command:\"replaceData\",\n    arguments:[tabledata]\n};\n\nglobal.set(\"savedata\", tabledata);\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":180,"wires":[["2f67ebdfe05368a8"]]},{"id":"84fce77886d70f14","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"savedata","pt":"global","to":"[]","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"[]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":120,"wires":[["2f67ebdfe05368a8"]]},{"id":"846d8fd7b5dd34e6","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":180,"wires":[["7efafbb18d1f7f81"]]},{"id":"baeef06c6f68d64e","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":120,"wires":[["84fce77886d70f14"]]},{"id":"475b1ea5d099553a","type":"ui_group","name":"Eindscore","tab":"6c20ebed9219bf3d","order":1,"disp":true,"width":"12","collapse":false,"className":""},{"id":"6c20ebed9219bf3d","type":"ui_tab","name":"Eindscore","icon":"dashboard","disabled":false,"hidden":false}]

thanks, it is working

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