UIBUILDER for Node-RED has several ways of displaying tabular or list data on a web page with little to no front-end coding required. Shown here are the 2 simplest methods with little to no code required.
For examples, lets assume you have messages like these:
{
topic: "mytable",
payload: [
{ col1: 'Row 1, Col 1', col2: 11, },
{ col1: 'Row 2, Col 1', col2: 22, },
{ col1: 'Row 3, Col 1', col2: 33, },
],
}
{
topic: "mylist",
payload: [
'List entry 1',
'List entry 2',
'List entry 3',
],
}
The simplest (but needs a bit of HTML)
Using the <uib-var> custom web component that is provided by uibuilder, you can automatically format data provided in a message from Node-RED. All you need is to add this to your index.html file, in the <body> section.
<article><!-- Not really needed but makes the display clearer -->
<uib-var topic="mylist" type="list"></uib-var>
<uib-var topic="mytable" type="table"></uib-var>
</article>
So just 1 line of HTML give you formatted output from a simple message.
Note that updating individual elements of your list or table is a little more complex with this solution since this approach does not fully ID each element (as of v7.6). This may change in the future.
Using the node-code uib-element node
This node has specific settings to convert input data to formatted HTML including for Lists (of various types, not just bullet lists as with the last method) and for tables.
Processing of data is much more comprehensive and flexible than the previous method. In addition, entries are ID'd in detail so changing an individual element in the list or table is somewhat simpler. There is a very comprehensive example in the Node-RED library that demonstrates everything.
This approach does have to transmit more data from Node-RED to the web page so extremely large outputs may be a little slower depending on your network connection. In most cases this will not be noticable.
