Hello,
I had created a table with button in rows.
The button send the name of the first cell of the selected row
I'm facing an issue with this code below. when I press the button I get the payload with right value, but the table diseappear.
I'm not an html expert, any idea about what's going wrong ?
[
{
"id": "193110f5d82adc19",
"type": "ui_template",
"z": "b8410c8ad6d1ccb1",
"group": "623131314aba8708",
"name": "Table",
"order": 1,
"width": 0,
"height": 0,
"format": "<style>\n table {\n border-spacing: 0;\n width: 100%;\n border: 1px solid #ddd;\n }\n\n th {\n cursor: pointer;\n }\n\n th,\n td {\n text-align: left;\n padding: 16px;\n }\n\n tr:nth-child(even) {\n background-color: #f2f2f2\n }\n</style>\n<script>\n var value = \"hello world\";\n // or overwrite value in your callback function ...\n this.scope.action2 = function(el) { return el.file; }\n this.scope.action = function(el) { return value; }\n</script>\n\n<table id=\"myTable\">\n <tr>\n <th>file</th>\n <th>size</th>\n <th>size2</th>\n </tr>\n <tr ng-repeat=\"obj in msg.payload\">\n <td>{{obj.file}}</td>\n <td>{{obj.size}}</td>\n <td><button ng-click=\"send({payload:action2(obj)})\"> action </button></td>\n </tr>\n</table>",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"className": "",
"x": 270,
"y": 100,
"wires": [
[
"390471e58414168a"
]
]
},
{
"id": "390471e58414168a",
"type": "debug",
"z": "b8410c8ad6d1ccb1",
"name": "debug 257",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 470,
"y": 100,
"wires": []
},
{
"id": "7e56d20ac7fb150c",
"type": "inject",
"z": "b8410c8ad6d1ccb1",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "[ {\"file\":\"value1\",\"size\":\"value2\"}, {\"file\":\"value3\",\"size\":\"value4\"}, {\"file\":\"value5\",\"size\":\"value6\"}, {\"file\":\"value7\",\"size\":\"value8\"}, {\"file\":\"value9\",\"size\":\"value10\"}, {\"file\":\"value11\",\"size\":\"value12\"} ]",
"payloadType": "json",
"x": 110,
"y": 100,
"wires": [
[
"193110f5d82adc19"
]
]
},
{
"id": "623131314aba8708",
"type": "ui_group",
"name": "list",
"tab": "6cdb0c33ce269daf",
"order": 1,
"disp": false,
"width": "22",
"collapse": false,
"className": ""
},
{
"id": "6cdb0c33ce269daf",
"type": "ui_tab",
"name": "Files",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]