UI_TABLE : How to add row at the end of the table

Hi !
I'm using the ui_table, and I'm updating it dynamically with results of measurements done with STM32 microcontrollers.

The fonction " addResult" is looking like this:
msg.payload=
{
command: "addRow",
arguments: [
{
"Frequency":flow.get("currentFrequency"),
"RSSI":flow.get("currentRSSI"),
"SNR": flow.get("currentSNR"),
"PER": flow.get("currentPER")
},
true
],
returnPromise: true
}
return msg;

and previously I've called a fonction "ClearTable" like this :

msg.payload=[{
"Frequency":"",
"RSSI":"",
"SNR": "",
"PER": ""
}];
return msg;

my concern is that the table is updated with the last result at the beginning of the table while I would prefer to see it at the end of the table.

Is there any solution ?
Thanks for your help

Have a look in the Example section for the ui_table when you select 'Import' on the right-hand of the screen.
There's an example about... sending_commands that covers adding a row at the bottom or top of the table.

Basically, I think all you need to do is change the boolean from true to false where I've indicated.

msg.payload=
{
command: "addRow",
arguments: [
{
"Frequency":flow.get("currentFrequency"),
"RSSI":flow.get("currentRSSI"),
"SNR": flow.get("currentSNR"),
"PER": flow.get("currentPER")
},
false <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
],
returnPromise: true
}
return msg;
3 Likes

All commands are documented:

There you can also find a clearData() command to effectively clear your table.

If you can work with an index field I mostly use updateOrAddData() to either insert rows or updating existing.

1 Like

Thanks a lot ! It's working fine.

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