[Solved] | Table Node - Not updating without a page refresh?

Hi all,
I'm using the node-red-node-ui-table v0.4.5
NodeRed v4.1.5

I'm feeding it an array that does display, however it fails to update without refreshing the page. I know updates are being send to the ui node but nothing in the table unless I refresh the page. All other elements in my dashboard update as new data is issued, it's just the table that refuses to live-update.

Is this just a limitation of the node, or am I doing something wrong?

The dashboard is data from the Trading 212 API so unable to do a complete screenshot without substantial redactions... :hugs:

Below is the function node that generates the array for the table node.

// Get stored history (or start empty)
let history = flow.get("numberHistory") || [];

// Make sure incoming value is a number
let value = Number(msg.payload);
if (isNaN(value)) {
    return null;
}

// Add new value to the front
history.unshift({
    "Time": new Date().toLocaleTimeString('en-GB', { hour12: false }),
    "P&L Change": Number(value.toFixed(2))
});

// Keep only last 100 entries
if (history.length > 100) {
    history.pop();
}

// Save back to flow context
flow.set("numberHistory", history);

// Send entire array to table
msg.payload = history;
return msg;

It is fed with a simple number value msg.payload

Thanks,

Maybe this topic and the ui-table examples will help you. Node-red-ui-table don't refresh automatically - #2 by E1cid

1 Like

I added the below to my function node to force a reload of the table data.

// Send command to replace table data
msg.payload = {
    command: "replaceData",
    arguments: [history]
};

Seems to work now.
Thanks.