the ui-template flow now transfered to ui-table flow:
[
{
"id": "fd3a93decc2a1270",
"type": "tab",
"label": "e.g. ui-table",
"disabled": false,
"info": ""
},
{
"id": "ec34c6ada52855bd",
"type": "change",
"z": "fd3a93decc2a1270",
"name": "Table Configuration",
"rules": [
{
"t": "set",
"p": "ui_control",
"pt": "msg",
"to": "$format := {\t \"tabulator\": {\t \"tableBuilt\":\"function(){this.tablebuilt = true;}\",\t \"dataLoaded\":\"function(data){if(this.tablebuilt){this.tablebuilt=false; this.send({topic:'build table', ui_control:{callback:'tableBuilt'}})}else{this.send({topic:'success', ui_control:{callback:'setData'}, return:{command:'setData', arguments:[data]}})}}\"\t }\t}",
"tot": "jsonata"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{}",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 730,
"y": 220,
"wires": [
[
"31731e53875dacf5"
]
],
"icon": "node-red/cog.svg"
},
{
"id": "863b8f9b8d52963d",
"type": "inject",
"z": "fd3a93decc2a1270",
"name": "",
"props": [
{
"p": "payload",
"v": "-1",
"vt": "num"
},
{
"p": "topic",
"v": "",
"vt": "string"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "-1",
"payloadType": "num",
"x": 230,
"y": 220,
"wires": [
[
"ec34c6ada52855bd"
]
]
},
{
"id": "29ee456cbd10be91",
"type": "debug",
"z": "fd3a93decc2a1270",
"name": "TABLE",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1370,
"y": 100,
"wires": []
},
{
"id": "31731e53875dacf5",
"type": "ui_table",
"z": "fd3a93decc2a1270",
"group": "d04cb83acc2064af",
"name": "Content",
"order": 1,
"width": "20",
"height": "12",
"columns": [
{
"field": "no",
"title": "No",
"width": "",
"align": "left",
"formatter": "rownum",
"formatterParams": {
"target": "_blank"
}
},
{
"field": "name",
"title": "Name",
"width": "",
"align": "left",
"formatter": "plaintext",
"formatterParams": {
"target": "_blank"
}
},
{
"field": "id",
"title": "ID",
"width": "",
"align": "left",
"formatter": "plaintext",
"formatterParams": {
"target": "_blank"
}
},
{
"field": "address",
"title": "Address",
"width": "",
"align": "left",
"formatter": "plaintext",
"formatterParams": {
"target": "_blank"
}
},
{
"field": "country",
"title": "Contry",
"width": "",
"align": "left",
"formatter": "plaintext",
"formatterParams": {
"target": "_blank"
}
},
{
"field": "occupation",
"title": "Occupation",
"width": "",
"align": "left",
"formatter": "plaintext",
"formatterParams": {
"target": "_blank"
}
},
{
"field": "age",
"title": "Age",
"width": "",
"align": "left",
"formatter": "plaintext",
"formatterParams": {
"target": "_blank"
}
},
{
"field": "timestamp",
"title": "Timestamp",
"width": "",
"align": "left",
"formatter": "plaintext",
"formatterParams": {
"target": "_blank"
}
}
],
"outputs": 1,
"cts": true,
"x": 1140,
"y": 220,
"wires": [
[
"f18a891c4099b790",
"29ee456cbd10be91"
]
]
},
{
"id": "a2696265f95db3aa",
"type": "ui_button",
"z": "fd3a93decc2a1270",
"name": "",
"group": "21028a285361e1fc",
"order": 2,
"width": 0,
"height": 0,
"passthru": false,
"label": "Clear Database",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "",
"payloadType": "str",
"topic": "clear all",
"topicType": "str",
"x": 200,
"y": 500,
"wires": [
[
"821293d40021dc19"
]
]
},
{
"id": "0f7aca16675ee795",
"type": "ui_form",
"z": "fd3a93decc2a1270",
"name": "",
"label": "New Item",
"group": "21028a285361e1fc",
"order": 1,
"width": 0,
"height": 0,
"options": [
{
"label": "Name",
"value": "name",
"type": "text",
"required": true,
"rows": null
},
{
"label": "Address",
"value": "address",
"type": "text",
"required": true,
"rows": null
},
{
"label": "Country",
"value": "country",
"type": "text",
"required": true,
"rows": null
},
{
"label": "Occupation",
"value": "occupation",
"type": "text",
"required": true,
"rows": null
},
{
"label": "Age",
"value": "age",
"type": "text",
"required": true,
"rows": null
}
],
"formValue": {
"name": "",
"address": "",
"country": "",
"occupation": "",
"age": ""
},
"payload": "",
"submit": "submit",
"cancel": "cancel",
"topic": "add item",
"topicType": "str",
"splitLayout": "",
"className": "",
"x": 220,
"y": 660,
"wires": [
[
"18dcb329f842183f"
]
]
},
{
"id": "18dcb329f842183f",
"type": "function",
"z": "fd3a93decc2a1270",
"name": "ID Generator",
"func": "msg.payload.id = RED.util.generateId();\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 390,
"y": 660,
"wires": [
[
"821293d40021dc19"
]
]
},
{
"id": "821293d40021dc19",
"type": "change",
"z": "fd3a93decc2a1270",
"name": "delete socketid",
"rules": [
{
"t": "delete",
"p": "socketid",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 640,
"y": 500,
"wires": [
[
"fbe860b501639c1a"
]
]
},
{
"id": "fbe860b501639c1a",
"type": "function",
"z": "fd3a93decc2a1270",
"name": "Database",
"func": "let db = context.get('db');\nif(db === undefined){\n db = [];\n}\nswitch(msg.topic){\n case 'add item':\n msg.payload.timestamp = new Date().toISOString();\n db.push(msg.payload);\n context.set('db', db);\n msg.payload={\n command:\"addRow\",\n arguments: [\n [\n msg.payload\n ],\n false //false = add on end of list\n ],\n returnPromise: true\n }\n break;\n case 'build table':\n msg.payload={\n command:\"setData\",\n arguments: [\n db\n ],\n returnPromise: false\n }\n break;\n case 'clear all':\n db = [];\n context.set('db', db);\n msg.payload={\n command:\"setData\",\n arguments: [\n db\n ],\n returnPromise: false\n }\n break;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 900,
"y": 500,
"wires": [
[
"35571d7bd35ac114",
"31731e53875dacf5"
]
]
},
{
"id": "35571d7bd35ac114",
"type": "debug",
"z": "fd3a93decc2a1270",
"name": "DATABASE",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1290,
"y": 500,
"wires": []
},
{
"id": "f18a891c4099b790",
"type": "switch",
"z": "fd3a93decc2a1270",
"name": "",
"property": "topic",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "build table",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 1370,
"y": 220,
"wires": [
[
"4d8aebc1b773d32e"
]
]
},
{
"id": "4d8aebc1b773d32e",
"type": "change",
"z": "fd3a93decc2a1270",
"name": "",
"rules": [
{
"t": "delete",
"p": "ui_control",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1400,
"y": 280,
"wires": [
[
"fbe860b501639c1a"
]
]
},
{
"id": "d04cb83acc2064af",
"type": "ui_group",
"name": "Database",
"tab": "635ba43dc8d01298",
"order": 2,
"disp": true,
"width": "20",
"collapse": false,
"className": ""
},
{
"id": "21028a285361e1fc",
"type": "ui_group",
"name": "Input",
"tab": "635ba43dc8d01298",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "635ba43dc8d01298",
"type": "ui_tab",
"name": "example ui-table",
"icon": "track_changes",
"order": 1,
"disabled": false,
"hidden": false
}
]