Skip to content

Instantly share code, notes, and snippets.

@Gippsman2017
Last active May 25, 2020 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gippsman2017/0dcb1fe12a68b674b395b8adb3920dc0 to your computer and use it in GitHub Desktop.
Save Gippsman2017/0dcb1fe12a68b674b395b8adb3920dc0 to your computer and use it in GitHub Desktop.
Node-Red-Contrib-UI-Etable Example1

Here is a very simple example of how to use this node

[{"id":"7f7c6824.54e94","type":"tab","label":"Etable Test","disabled":false,"info":""},{"id":"ee24aebb.54f0e8","type":"ui_etable","z":"7f7c6824.54e94","payload":"[{\"title\":\"PushMe\",\"field\":\"PushMe\",\"width\":\"10%\",\"editor\":false},{\"title\":\"My Field A\",\"field\":\"a\",\"width\":\"80%\",\"editor\":true},{\"title\":\"My Field A - Type\",\"field\":\"b\",\"editor\":\"select\",\"editorParams\":{\"values\":[\"NEW\",\"UPDATED\",\"CANCELED\"]}}]","payloadType":"json","options":"{\"movableColumns\":true,\"layout\":\"fitColumns\",\"pagination\":\"local\",\"height\":\"700px\"}","group":"81b1bfdb.4662f8","name":"","order":2,"width":"20","height":"7","columns":[],"outputs":1,"cts":false,"x":690,"y":180,"wires":[["db83b4fb.4adf48","8fa2d566.9b9528"]]},{"id":"861cc629.8485","type":"inject","z":"7f7c6824.54e94","name":"","topic":"","payload":"{\"a\":\"wombat\",\"b\":\"NEW\"}","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":390,"y":260,"wires":[["5cc9caef.b0116c","c2f61254.095ab8"]]},{"id":"db83b4fb.4adf48","type":"debug","z":"7f7c6824.54e94","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":890,"y":120,"wires":[]},{"id":"5cc9caef.b0116c","type":"debug","z":"7f7c6824.54e94","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":340,"wires":[]},{"id":"c2f61254.095ab8","type":"function","z":"7f7c6824.54e94","name":"","func":"var a1 = '12345';\nvar a2 = 'ABCDE';\n\nmsg.payload = [\n{ \"PushMe\":\"a1\", \"a\" : a1, \"b\" : 'NEW' },\n{ \"PushMe\":\"a2\", \"a\" : a2, \"b\" : 'UPDATE' }];\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":200,"wires":[["ee24aebb.54f0e8"]]},{"id":"8fa2d566.9b9528","type":"ui_text","z":"7f7c6824.54e94","group":"81b1bfdb.4662f8","order":2,"width":"8","height":"3","name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","x":1020,"y":220,"wires":[]},{"id":"81b1bfdb.4662f8","type":"ui_group","z":"","name":"test","tab":"700e0299.f39d8c","order":1,"disp":true,"width":"20","collapse":false},{"id":"700e0299.f39d8c","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
@r0ller
Copy link

r0ller commented Jan 14, 2020

Hi,

It looks pretty nice! One question though: how do I get the table back with all the changed data? In the example, whenever the user clicks the pushme field, the payload contains the changed data and the complete table as well. However, if only the data in the editable cell is changed, nothing seems to be triggered and I don't see how I can get the table content back. I tried to inject the options and columns via flow context variables but the table didn't get displayed that way. Though, I hoped to be able to inject a cellClick function through which one might get some feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment