Problem with data displayed in UI-Table when switching Tabs

So something like a logfile ....

This is using a little bit more complex (but universal) subflow I use for all my tables.

But you can do it more simple too:

A) a function node which gets an array (of lines) from the flow context and pushes the new line at the end
B) a second function node triggered by ui-control gets the same context array and send it to ui-table

I splittend it up to different nodes to make it easier to understand / debug - The tricky part is to scroll the table if you insert your rows at the end of the table.

[{"id":"5157b913.480ca8","type":"inject","z":"d1227ddb.952f7","name":"","props":[{"p":"timestamp","v":"","vt":"date"}],"repeat":"10","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":135,"y":578,"wires":[["13f98b83.2e2974"]]},{"id":"13f98b83.2e2974","type":"function","z":"d1227ddb.952f7","name":"demo data","func":"let counter = context.get('counter') || 0;\ncounter++;\ncontext.set('counter',counter);\n\nvar output = {\n    payload:{\n        id : counter,\n        timestamp : msg.timestamp,\n        text : `Line #${counter}`,\n        value : counter\n    }\n}\n\nreturn output;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":308,"y":578,"wires":[["81a5a8e6.5418f8"]]},{"id":"81a5a8e6.5418f8","type":"function","z":"d1227ddb.952f7","name":"store data","func":"let tabledata = flow.get('tabledata') || [];\ntabledata.push(msg.payload);\nflow.set('tabledata',tabledata);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":485,"y":578,"wires":[["d6ec8129.da035"]],"icon":"node-red/db.svg"},{"id":"d6ec8129.da035","type":"function","z":"d1227ddb.952f7","name":"addData","func":"// http://tabulator.info/docs/4.9/update#alter-add\nvar output={\n    payload:{\n        command: \"addData\",\n        arguments: [\n            [ msg.payload ],\n            false\n        ]\n    }\n  }\n\n// http://tabulator.info/docs/4.9/navigation#scroll-row\nvar scroll={\n    payload:{\n        command: \"scrollToRow\",\n        arguments: [\n            msg.payload.id,\n            \"top\",\n            true\n        ]\n    }  \n}\nreturn [[output,scroll]];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":655,"y":578,"wires":[["82bc171.d9d5de8","1c88a7d4.6e7b88"]],"icon":"font-awesome/fa-table"},{"id":"f9eb75ea.c53888","type":"ui_ui_control","z":"d1227ddb.952f7","name":"","events":"all","x":315,"y":646,"wires":[["75d7057b.e0eeec"]]},{"id":"75d7057b.e0eeec","type":"function","z":"d1227ddb.952f7","name":"get data","func":"msg.payload = flow.get('tabledata') || [];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":485,"y":646,"wires":[["82bc171.d9d5de8"]],"icon":"node-red/db.svg"},{"id":"82bc171.d9d5de8","type":"ui_table","z":"d1227ddb.952f7","group":"5bf56b63.75b254","name":"","order":0,"width":"6","height":"7","columns":[],"outputs":0,"cts":false,"x":833,"y":612,"wires":[]},{"id":"1c88a7d4.6e7b88","type":"debug","z":"d1227ddb.952f7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":832,"y":578,"wires":[]},{"id":"5bf56b63.75b254","type":"ui_group","name":"Logfile","tab":"bae8e16f.a9faa","order":2,"disp":true,"width":"6","collapse":true},{"id":"bae8e16f.a9faa","type":"ui_tab","name":"ui-table","icon":"dashboard","order":1,"disabled":false,"hidden":false}]